It is undefined to raise a negative number to a non-integer power. However, Fortran compilers differ in their handling of the case when the power is an integer represented as a floating point number. Consider the following code:
With Intel compiler this is the result:
But with NAG compiler all of the results are NaN:
program test implicit double precision(a-h,o-z) a=-26.5227750387574375d0 b=1.0000000000000000d0 write(6,*)a**(b-0.01d0) write(6,*)a**b write(6,*)a**(b+0.01d0) end
With Intel compiler this is the result:
> ifort test.f > ./a.out NaN -26.5227750387574 NaN
But with NAG compiler all of the results are NaN:
> nagfor -ieee=full test.f > ./a.out NaN NaN NaN