|
problems w/ c++ pow() function
Ignore this. I had the values in the function reversed.
I'm having trouble w/ pow() where it won't return the correct value. For instance, the following code works:
double i = 4;
double j;
j = pow(2,i);
(j now holds 16)
The following code returns 2.09715e+06
double i = 21;
double j;
j = pow(2,i);
(j now holds 2.09715e+06
Even using the fixed and showpoint operaters I get a value that's way off from 441 (what j should hold if I'm not mistaken). I've tried using float and long double data types as well.
|