__builtin_cpow((0,0),(0,0))

Duncan Sands baldrick@free.fr
Mon Mar 7 16:31:00 GMT 2005


Hi Chris,

> | Mathematically speaking zero^zero is undefined, so it should be NaN.
> | This already clear for real numbers: consider x^0 where x decreases
> | to zero.  This is always 1, so you could deduce that 0^0 should be 1.
> | However, consider 0^x where x decreases to zero.  This is always 0, so
> | you could deduce that 0^0 should be 0.  In fact the limit of x^y
> | where x and y decrease to 0 does not exist, even if you exclude the
> | degenerate cases where x=0 or y=0.  This is why there is no reasonable
> | mathematical value for 0^0.
> |
> 
> That is true.
> 
> However, on the other hand, however the standard says looks to me to say
> 0^0=1. Also printf("%f",pow(0.0,0.0)) returns 1.0 on both VC++6 and g++
> 3.3 (just what I happen to have lying around..)
> 
> I would agree with Paolo that the most imporant point is arguably
> consistency, and it looks like that is pow(0.0,0.0)=1

just so long as everyone understands that they are upholding the
standard, not mathematics, then that is fine by me :)

All the best,

Duncan.

PS: There is always the question of which standard is being upheld,
since presumably both the Fortran and Ada standards have something
to say about this.



More information about the Gcc mailing list