[R6RS] (integer? +inf.0) => ? [was: NaNs and infinities]

Michael Sperber sperber at informatik.uni-tuebingen.de
Tue Mar 28 10:04:52 EST 2006


It seems that the discussion on arithmetic is down to two principal
issues:

- operations for integer division (which Will and I can resolve, I
  believe)
- the values of (integer? +inf.0)  and (rational? +inf.0)

For the latter, Will prefers that they return #f, and Kent prefers
that they return #t.

Here's Kent's rationale:

> I would have (rational? -inf.0) be #t as well.
> 
> Beyond a certain number of digits, all IEEE floats are integers.  +inf.0
> and -inf.0, which represent the limits that the sequence of representable
> floats apprach in either direction, should also be integers.
> 
> I'm not even sure why you treat +nan.0 as irrational.  This is definitely
> a departure from R5RS, which not only allows rational? to be the same as
> real? but states that this is how it will be in most implementations.
> I don't understand why you have departed from that.

Here's Will's rationale:

> As you explained, +inf.0 actually stands for all of the real
> numbers that are above a certain size.  Most of the numbers
> for which +inf.0 stands are not integers.  That argument is
> not at all convincing, however, because the same is true of
> *all* inexact integers.
> 
> At some point, you have to look at the operational meaning
> of integer? and other predicates.  One of the main uses of
> integer? in SRFI 77 is to define the domain on which things
> like flodd?, fleven?, flquotient, flremainder, inexact-odd?,
> and inexact-even? are defined.  If we don't want to have to
> describe how these things behave on +inf.0 or -inf.0, then
> we can exclude them from the domain by defining them as
> non-integers.  That is the approach taken in SRFI 77.
> 
> This would be a bad thing to do if there were plausible
> examples of problems it would cause.  If you can think
> of such problems, we'd like to hear about them.

(More discussion further up in this thread, if you're interested.)

I personally prefer that they they return #f.  Any other opinions?

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla



More information about the R6RS mailing list