infinities are not rational

This commit is contained in:
Alex Shinn 2011-11-27 21:40:50 +09:00
parent a1057fa88e
commit b84dba8425

View file

@ -952,9 +952,10 @@
(define (number? x) (if (inexact? x) #t (exact? x))) (define (number? x) (if (inexact? x) #t (exact? x)))
(define complex? number?) (define complex? number?)
(cond-expand (cond-expand
(complex (define (rational? x) (and (number? x) (not (%complex? x))))) (complex (define (real? x) (and (number? x) (not (%complex? x)))))
(else (define rational? number?))) (else (define real? number?)))
(define real? rational?) (define (rational? x)
(and (real? x) (= x x) (not (= x (+ x (if (positive? x) 1 -1))))))
(define (exact-integer-sqrt x) (define (exact-integer-sqrt x)
(let ((res (sqrt x))) (let ((res (sqrt x)))