This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: __builtin_cpow((0,0),(0,0))


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]