From jason at acm.org  Mon Oct 27 14:31:00 2008
From: jason at acm.org (Jason Riedy)
Date: Mon, 27 Oct 2008 09:31:00 -0400
Subject: [Rd] 0 ^ NaN == Inf, why?
In-Reply-To: <490379A9.3090903@r-project.org> (John Chambers's message of
	"Sat, 25 Oct 2008 15:55:21 -0400")
References: <54BCF12B6BE6423DBC6CA23B9B7D5D23@dell16>
	<490376DE.101@r-project.org> <490379A9.3090903@r-project.org>
Message-ID: <871vy2w4ff.fsf@sparse.dyndns.org>

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



[Rd] 0 ^ NaN == Inf, why?
Jason Riedy