mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
nans aren't rational
This commit is contained in:
parent
c174465aa1
commit
48d6c35548
2 changed files with 2 additions and 0 deletions
|
@ -1376,6 +1376,7 @@
|
||||||
(else (define real? number?)))
|
(else (define real? number?)))
|
||||||
(define (rational? x)
|
(define (rational? x)
|
||||||
(and (real? x)
|
(and (real? x)
|
||||||
|
(= x x)
|
||||||
(if (or (> x 1) (< x -1))
|
(if (or (> x 1) (< x -1))
|
||||||
(not (= x (/ x 2)))
|
(not (= x (/ x 2)))
|
||||||
(<= -1 x 1))))
|
(<= -1 x 1))))
|
||||||
|
|
|
@ -749,6 +749,7 @@
|
||||||
(test #t (real? #e1e10))
|
(test #t (real? #e1e10))
|
||||||
(test #t (real? +inf.0))
|
(test #t (real? +inf.0))
|
||||||
(test #f (rational? -inf.0))
|
(test #f (rational? -inf.0))
|
||||||
|
(test #f (rational? +nan.0))
|
||||||
(test #t (rational? 9007199254740991.0))
|
(test #t (rational? 9007199254740991.0))
|
||||||
(test #t (rational? 9007199254740992.0))
|
(test #t (rational? 9007199254740992.0))
|
||||||
(test #t (rational? 1.7976931348623157e308))
|
(test #t (rational? 1.7976931348623157e308))
|
||||||
|
|
Loading…
Add table
Reference in a new issue