mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 06:09:18 +02:00
fixing numerator/denominator definitions on inexacts when ratios are supported
This commit is contained in:
parent
a8e721da94
commit
a5fbdccbfc
1 changed files with 2 additions and 2 deletions
|
@ -922,11 +922,11 @@
|
||||||
(define (numerator x)
|
(define (numerator x)
|
||||||
(if (ratio? x)
|
(if (ratio? x)
|
||||||
(ratio-numerator x)
|
(ratio-numerator x)
|
||||||
(if (integer? x) x (numerator (* x 10)))))
|
(if (inexact? x) (ratio-numerator (inexact->exact x)) x)))
|
||||||
(define (denominator x)
|
(define (denominator x)
|
||||||
(if (exact? x)
|
(if (exact? x)
|
||||||
(if (ratio? x) (ratio-denominator x) 1)
|
(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
|
(else
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(complex
|
(complex
|
||||||
|
|
Loading…
Add table
Reference in a new issue