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

Paolo Carlini pcarlini@suse.de
Mon Mar 7 17:32:00 GMT 2005


Chris Jefferson wrote:

> 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

Agreed. However, I'm afraid that, short term at least, we must live with
0^0 returning different values in the real and complex domains, because,
of course, not only __builtin_cpow, but cpow itself (as implemented by
glibc) returns (nan, nan), and definitely we cannot change it ;)

The consistency issue actually changes now, for the libstdc++-v3 people: in
my opinion we should make sure that the various complex::pow overloads
always return (nan, nan) for zero^zero. We are far from that and I'm going
to work on it.

Paolo.



More information about the Libstdc++ mailing list