ljbeng
Joined: 10 Feb 2004 Posts: 205
|
Negative result for POW function |
Posted: Wed Oct 01, 2008 12:42 pm |
|
|
I looked through the math.h file and found in 3.249 that the POW function returns a negative number when squaring the value.
Code: |
temp = -2;
temp1 = pow(temp,2);
temp1 = -4
|
from math.h
Code: |
float pow(float x,float y)
{
if(x>=0)
return( exp(y*log(x)) );
else
return( -exp(y*log(-x)) );
}
|
|
|