When I execute
echo pow( -0.3741569180353 , 0.2 ) ;
I am getting result NAN
While in excel and calculator, I am getting the answer -0.8215.
What is the solution to fix this as I am having lot of such calculations ?
After some consultation with the experts in Room #11, pow()
won't work with the root of a negative number.
Should the answer be 0.8215
or -0.8215
?
Quirkily, using the **
(power) operator will work with the root of a negative number
echo -0.3741569180353 ** 0.2 ;
because **
has higher precedence than -
, so effectively what you're doing is
echo -(0.3741569180353 ** 0.2) ;