[R6RS] NaNs and infinities

William D Clinger will at ccs.neu.edu
Wed Mar 8 22:51:18 EST 2006


Kent wrote:
> > Some examples still allow 0 or 0.0, or +inf.0 or an
> > exception.
>
> ... or +nan.0 or an exception.

Right, thanks.

> > (* +nan.0 x)  ==>  +nan.0
>
> Only when x is not 0.  (* +nan.0 0) ==> 0 or +nan.0

Right again, thanks.

> > (max +inf.0 x)  ==>  +inf.0
> > (min -inf.0 x)  ==>  -inf.0
>
> Do these hold when x = +nan.0, or do you want
> (max x +nan.0) = (min x +nan.0) = +nan.0?

Right again, thanks.  We want
(max x _nan.0) = (min x +nan.0) = +nan.0, and should
add those examples to SRFI 77.

> (Or do we?  Maybe that's what this mysterious real-valued? is.)

Let me review a bit of what is going on with SRFI 77.  As
Bradley Lucier suggested back in 1998, we are redefining
real? to exclude complex numbers whose imaginary part is
inexact.  This implies redefinitions of rational? and
integer?, else the rationals and integers would no longer
be subsets of the reals.  Since we had to redefine the
rational? predicate anyway, we redefined it to exclude
reals whose value is not = to the ratio of two exact 
integers.  Since we had to redefine the integer? predicate
anyway, we redefined it to exclude rationals whose denominator
is not = to 1.

This implies there are complex numbers, e.g. 3.0+0.0i, that
are not themselves a real but are = to a real, that are not
a rational but are = to a rational, that are not an integer
but are = to an integer.  The real-value?, rational-valued?,
and integer-valued? predicates are true if and only their
argument is a number that is, respectively,  = to a real, a
rational, or an integer.

Will



More information about the R6RS mailing list