Okay, I admit it. You want the lowdown on the "pow" in power? Here:
---------------- cut here ----------------
/* powdemo.c */
/* powdemo - demo pow function
*/
#include <stdio.h>
main()
{
double pow();
short i;
for (i = 0; i < 10; ++i)
printf("2 to the power %d equals %.0f\n",
i, pow(2., (double)i));
}
/* pow - return (positive) x to the power y
*/
double pow(x, y)
double x; /* base */
double y; /* exponent */
{
double exp(); /* returns e to the x-th power */
double log(); /* returns log x to the base e */
return (exp(log(x) * y));
}
---------------- cut here ----------------
There. You've got it. Now leave what's left of my sex life out of this.
dr foo
______________________________________________________________________________
Gary L. Dryfoos | "So, you cannot resist,
ARPA/Internet: dryfoo@athena.mit.edu | can you? No, no one can!
UUCP/Usenet: ...mit-eddie!athena.mit.edu!dryfoo | When LeMott sings, they
Phone: (617) 253-0184 / (617) 825-6115 | dance! Ha-ha-ha!
USPS: E40-318, MIT, Cambridge, MA 02139 | They all dance!"
==============================================================================