From b84dba84251d700a4fb8777276d206929857ec34 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sun, 27 Nov 2011 21:40:50 +0900 Subject: [PATCH] infinities are not rational --- lib/init-7.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/init-7.scm b/lib/init-7.scm index 031afd21..8285bdd7 100644 --- a/lib/init-7.scm +++ b/lib/init-7.scm @@ -952,9 +952,10 @@ (define (number? x) (if (inexact? x) #t (exact? x))) (define complex? number?) (cond-expand - (complex (define (rational? x) (and (number? x) (not (%complex? x))))) - (else (define rational? number?))) -(define real? rational?) + (complex (define (real? x) (and (number? x) (not (%complex? x))))) + (else (define real? number?))) +(define (rational? x) + (and (real? x) (= x x) (not (= x (+ x (if (positive? x) 1 -1)))))) (define (exact-integer-sqrt x) (let ((res (sqrt x)))