fixing numerator/denominator definitions on inexacts when ratios are supported

This commit is contained in:
Alex Shinn 2011-11-27 22:25:03 +09:00
parent a8e721da94
commit a5fbdccbfc

View file

@ -922,11 +922,11 @@
(define (numerator x)
(if (ratio? x)
(ratio-numerator x)
(if (integer? x) x (numerator (* x 10)))))
(if (inexact? x) (ratio-numerator (inexact->exact x)) x)))
(define (denominator x)
(if (exact? x)
(if (ratio? x) (ratio-denominator x) 1)
(let lp ((x x) (r 1.0)) (if (integer? x) r (lp (* x 10) (* r 10)))))))
(if (integer? x) 1 (ratio-denominator (inexact->exact x))))))
(else
(cond-expand
(complex