[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] More NaN and Infsanity

Peter Bex scripsit:

> For example (max +inf.0 +nan.0), should this return +inf.0 (which
> is the biggest number possible), or should it return +nan.0?

R6RS requires that (max +inf.0 x) for any real x return +inf.0; it is
silent about (max x +inf.0), but I'd think that was entailed.  Racket,
Gauche, MIT, Chicken (with and without the numbers egg), Scheme48, Guile,
Ypsilon, Mosh, IronScheme, STklos, Elk, VX return +inf.0.  On the other
hand, Gambit, Bigloo, Kawa, SISC, Chibi, Chez, Vicare, Larceny, NexJ,
UMB, Spark, FemtoLisp return +nan.0.  My other Schemes throw errors,
either because they don't like flonums, they don't like division by 0.0,
or they produce cockeyed values of (/ 1.0 0.0) and/or (/ 0.0 0.0).

Given that the six R6RS implementations are split 3-3, and that all the
Java ones prefer +nan.0, I don't think it's worth filing a ticket to
standardize this behavior.  Fast is almost certainly better than right
in this case.

> What should the value of the various trig functions be given nan/inf
> values?

Whatever IEEE 754 says.  Editorial ticket #365 will add more examples
(probably ripped off from R6RS) for the transcendental functions.

John Cowan     http://ccil.org/~cowan    cowan@x
Monday we watch-a Firefly's house, but he no come out.  He wasn't home.
Tuesday we go to the ball game, but he fool us.  He no show up.  Wednesday he
go to the ball game, and we fool him.  We no show up.  Thursday was a
double-header.  Nobody show up.  Friday it rained all day.  There was no ball
game, so we stayed home and we listened to it on-a the radio.  --Chicolini

Scheme-reports mailing list