Infinities and NaNs are no longer rational
authorMark H Weaver <mhw@netris.org>
Sat, 29 Jan 2011 04:32:20 +0000 (23:32 -0500)
committerAndy Wingo <wingo@pobox.com>
Sun, 30 Jan 2011 12:08:53 +0000 (13:08 +0100)
commitc960e55600962c45be7e623859eddca3fad87783
treec2b39d47d31923d52eb01774b4611ca58038b31e
parent2e6e1933b4ca26793741cc0ec0832978f10c0c99
Infinities and NaNs are no longer rational

* libguile/numbers.c (scm_rational_p): Return #f for infinities and
  NaNs, per R6RS.  Previously it returned #t for real infinities
  and NaNs.  They are still considered real by scm_real `real?'
  however, per R6RS.  Also simplify the code.

  (scm_real_p): New implementation to reflect the fact that the
  rationals and reals are no longer the same set.  Previously it just
  called scm_rational_p.

  (scm_integer_p): Simplify the code.

* test-suite/tests/numbers.test: Add test cases for `rational?'
  and `real?' applied to infinities and NaNs.

* doc/ref/api-data.texi (Real and Rational Numbers): Update docs to
  reflect the fact that infinities and NaNs are no longer rational, and
  that `real?'  no longer implies `rational?'.  Improve discussion of
  infinities and NaNs.

* NEWS: Add NEWS entries, and combine with an earlier entry about
  infinities no longer being integers.
NEWS
doc/ref/api-data.texi
libguile/numbers.c
test-suite/tests/numbers.test