On Thu, 18 Mar 2010, Vincent Lefevre wrote: > On 2010-03-18 15:32:04 +0100, Michael Matz wrote: > > > So, pow(-0.0, 0.5) should return +0. But sqrt(-0.0) should return -0 > > > according to the IEEE 754 standard (and F.9.4.5 from ISO C99). > > > > Yes, and I don't know why they specified it like that. After all > > (-0)*(-0)==+0 (not ==-0), so the above definition is internally > > insonsistent. Defining sqrt(-0) as +0 would be equally inconsistent, but > > at least agree with the pow(-0, 0.5) result. > > sqrt(-0) was defined first by the IEEE 754 standard in 1985. > AFAIK, -0 was chosen to allow a hack for some convention in > interval arithmetic (there may be other reasons). pow(-0, y) > was defined by the C committee.
And the same rule on pow(-0, y) is present in 754-2008 (I don't know whether this was deliberately following the C definition, or deciding independently that this was the right definition, but you may know as a listed member of the balloting committee). -- Joseph S. Myers jos...@codesourcery.com