Hi,
: i need to calcualte something like
: -12.567 ^ -0.256
:
: a normal pow(-12.567,-0.256) doesnt work obviously. I can still make
: it pow(-12.567,-0.256) if i use a recoprocal, bnut still the pow
: statement doesnt work,...
So, from the POW docs:
If "x" and "y" are both zero, or if "x" is non-positive and "y" is not an integer, "pow" return -HUGE_VAL and sets "errno" to EDOM.
The second part applies there and the "and" means we only need to deal with one of the conditions, so it would appear we can solve the problem by writing:
double z = -pow(12.567, -0.256);
Instead. Which works. Also this gives the same answer:
double z = -1.0 / pow(12.567, 0.256);
Which uses the reciprocal property you mention.
: my question is that is -12.567^-0.256==(-1^-0.256)*(12.567^-0.256)
: ???
Can't see how.
: and is -1 raised to any negative decimal power equla to -1 ???
No. What is -1 ^ -2? It is 1 / (-1 ^ 2) = 1 / (-1 * -1) = 1.
Jonathan
###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");