[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: FW: Transcendental function tables: comments welcome!
Fred J. Tydeman wrote:
On Fri, 25 May 2007 02:01:11 +0100 (BST), Malcolm Cohen wrote:
I don't see any justification for NaN**0.0==1, or any valid rationale.
There is another view. As I remember from the discussions, for any real x,
x**0 is 1. The limit as x approaches inf is still 1. Since x**0 is 1
for all finite x, infinite x, x**0 is independent of the value of x.
If NaN stands for any finite or infinite value, and x**0 is independent
of the value of x, then NaN**0 is also 1.
If one takes what is in the IEEE 754 and the drafts as a guide, in the
first instance, NaN's are the return value appropriate for a domain
error, e.g. 0.0/0.0, sqrt(-1.0) and a NaN input indicates such an error
has occurred, and thus should be propagated. If such domain errors
arise naturally in a calculation, they indicate a special case that
requires special attention. This is in accord with the general
principle of the standard, where one deals with the unexceptional case
using a straight-forward approach and then do a single check at the end
to determine if special measures are required. For this reason, the
above argument does not hold, i.e. pow(x,y) always returns NaN if either
argument is a NaN. The only exception to this principle that I can see
are the min/maxNum and min/maxNumMag functions, which treat NaN as an
uninitialised value to be ignored. I had the impression this caused
much angst and argument in the committee a few years ago.
The idea the NaN represents any number is not really supported by the
standard. What happens if you attempt to ascii to binary conversion of
"purple". It belongs more to an interval arithmetic approach, which
still needs NaN to deal with examples such as sqrt(-1).