mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 06:09:18 +02:00
infinities are not rational
This commit is contained in:
parent
a1057fa88e
commit
b84dba8425
1 changed files with 4 additions and 3 deletions
|
@ -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)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue