Some trivia questions.

Doug Gwyn (VLD/VMB) uunet!BRL.MIL!gwyn
Tue Sep 29 07:17:54 PDT 1992


HUGE_VAL is not correct for acos(1.1).  The result is not just "infinite"
but is undefined.  0.0 would be even worse.  Of course, with EDOM set the
implementation is free to return any old garbage but since you are asking
what the "right thing" is, I'd have to say a NaN.

acos(NaN) is no better or worse than 2*NaN, i.e. it ought to be a NaN.

The key in 4.5.1 is that the functions are defined only for all
REPRESENTABLE values of their arguments.  In CIB#1 there is an
explanation of what the model for floating-point representation is;
it excludes entities that are "nonnumeric" such as NaNs (but does
permit representation of infinities, subnormals, etc.).  Feeding a
NaN to a math library function enters "undefined" territory and
thus acos(SNaN) could raise an exception.



More information about the Numeric-interest mailing list