diff --git a/lib/init-7.scm b/lib/init-7.scm index d631bd30..dc703ab5 100644 --- a/lib/init-7.scm +++ b/lib/init-7.scm @@ -1376,6 +1376,7 @@ (else (define real? number?))) (define (rational? x) (and (real? x) + (= x x) (if (or (> x 1) (< x -1)) (not (= x (/ x 2))) (<= -1 x 1)))) diff --git a/tests/r7rs-tests.scm b/tests/r7rs-tests.scm index 258cecae..81067c9e 100644 --- a/tests/r7rs-tests.scm +++ b/tests/r7rs-tests.scm @@ -749,6 +749,7 @@ (test #t (real? #e1e10)) (test #t (real? +inf.0)) (test #f (rational? -inf.0)) +(test #f (rational? +nan.0)) (test #t (rational? 9007199254740991.0)) (test #t (rational? 9007199254740992.0)) (test #t (rational? 1.7976931348623157e308))