Re: [Scheme-reports] More NaN and Infsanity John Cowan (30 Apr 2012 07:43 UTC)
Re: [Scheme-reports] More NaN and Infsanity Peter Bex (30 Apr 2012 09:16 UTC)
Re: [Scheme-reports] More NaN and Infsanity Jussi Piitulainen (30 Apr 2012 10:51 UTC)
Re: [Scheme-reports] More NaN and Infsanity John Cowan (30 Apr 2012 17:02 UTC)
Re: [Scheme-reports] More NaN and Infsanity Jussi Piitulainen (30 Apr 2012 18:40 UTC)
Re: [Scheme-reports] More NaN and Infsanity John Cowan (30 Apr 2012 17:01 UTC)
Re: [Scheme-reports] More NaN and Infsanity Peter Bex (30 Apr 2012 17:34 UTC)

Re: [Scheme-reports] More NaN and Infsanity John Cowan 30 Apr 2012 17:01 UTC

Peter Bex scripsit:

> So, concretely, what should the behaviour of rationalize be for these
> values?
>
> It seems to me that both situations should probably be an error.

I agree.  If you look at Alan Bawden's implementation in the IEEE Scheme
standard (online at http://trac.sacrideo.us/wg/wiki/RationalizeDefinition ),
you can see that if the first argument is non-rational, an error
is signalled.  However, the second argument can be infinite, in which
case the result is 0.0, rather arbitrarily, because the boundaries of
the interval are going to be +inf.0 and -inf.0.  Signalling an error
for this case would be all right with me.

In any case, the numbers egg is buggy: it always returns an exact
rational even if the arguments are inexact.  Chibi's version of Bawden
is also buggy: it goes into an infinite loop if the second argument is
non-rational.  Bawden's code may not be the fastest, but it's elegant:
I suggest adopting it.

--
Go, and never darken my towels again!           John Cowan
        --Rufus T. Firefly                      http://ccil.org/~cowan

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports