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

[Scheme-reports] Rational? and real? predicates



Hello,

While working on the Chicken numbers code, I was confused about the
how the special values +inf, -inf and NaN should be treated by the
numerical predicates "rational?" and "real?".

I noticed that R6RS has an explicit note that "rational?" returns #f for
those flonums representing the infinities and NaN:
http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_idx_446
It doesn't say anything about "rational?" though.

R5RS and the R7RS draft have no such section, and it's unclear if the
predicates should return #t or #f for these values.  R5RS doesn't have
it because it doesn't explicitly allow for IEEE 754 numbers.

In R7RS 6.2.5 there's the following clause:
"Finite returns #t on all real numbers except +inf.0, -inf.0
  and +nan.0 [...]"
(BTW: I think the questionmark fell off the predicate's name here)

This implies that +inf.0, -inf.0 and +nan.0 *are* considered
real numbers.  Please clarify.  If this is intentionally left
unspecified, it would probably be good if that's stated explicitly.

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