Re: [Scheme-reports] More NaN and Infsanity
Peter Bex 29 Apr 2012 15:29 UTC
On Sat, Apr 28, 2012 at 04:49:24PM -0400, John Cowan wrote:
> > 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.
What about (rationalize x y) where x or y are nan or inf?
The notation seems to indicate that nan is allowed, since it's
"real but not rational". However, that same sentence seems to
indicate that rationalizing NaN would be an error.
On the other hand, R6RS seems to indicate that rationalize is
allowed to return +nan.0, see its examples:
(rationalize +inf.0 3) => +inf.0
(rationalize +inf.0 +inf.0) => +nan.0
(rationalize 3 +inf.0) => 0.0
I'm not sure if this is correct. OTOH, I don't fully grok
what rationalize does, so maybe I'm just wasting everyone's
time.
Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports