[Rd] 0 ^ NaN == Inf, why?
Jason Riedy
jason at acm.org
Mon Oct 27 14:31:00 CET 2008
And John Chambers writes:
> I tried a little harder, and apparently the guess is wrong. It seems
> that pow(0, -0) is 1 in C. Would seem better to either have pow(0,0)
> and pow(0,-0) both be NaN or else 1 and Inf, but ...
There are slides from Jim Thomas summarizing the C99 choices for
elementary functions at
http://grouper.ieee.org/groups/754/meeting-materials/2001-07-18-c99.pdf
or in an html version in the meeting notes at
http://grouper.ieee.org/groups/754/meeting-minutes/01-07-18.html
IIRC, pow(x, +/- 0) is taken to be 1 for all x because pow(x, 0) = 1 and
pow(x, -0) = 1/pow(x, 0) = 1/1 = 1 for all finite, numerical, non-zero
x. The NCEG folks spent a huge effort considering mathematical reasons
and actual applications when they chose the special case values.
Disagreements over special cases are natural, alas, but they did the
best anyone really could.
Jason
More information about the R-devel
mailing list