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

Re: [Scheme-reports] More NaN and Infsanity



On Mon, Apr 30, 2012 at 03:41:10AM -0400, John Cowan wrote:
> Peter Bex scripsit:
> 
> > 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.
> 
> Rationalizing infinity makes some sense, but rationalizing NaN does not,
> at least not to me.

What would the result be then?  According to the spec, both the
infinities and NaN are rational but not real so infinity is out,
and I don't see any sane value other than infinity (or maybe nan)
as output for, say (rationalize +inf.0 1).

> > On the other hand, R6RS seems to indicate that rationalize is
> > allowed to return +nan.0, see its examples:
> 
> Indeed, which cannot be right: both R5RS and R6RS require that the result
> be rational.

So, concretely, what should the behaviour of rationalize be for these
values?

It seems to me that both situations should probably be an error.

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@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports