mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 14:19:18 +02:00
Fixing typo in integer case of inexact numerator/denominator.
Fixes issue #179.
This commit is contained in:
parent
ced12fc92a
commit
d3cc4de281
2 changed files with 5 additions and 3 deletions
|
@ -1056,14 +1056,14 @@
|
||||||
(if (ratio? x)
|
(if (ratio? x)
|
||||||
(ratio-numerator x)
|
(ratio-numerator x)
|
||||||
(if (inexact? x)
|
(if (inexact? x)
|
||||||
(exact->inexact (ratio-numerator (inexact->exact x)))
|
(exact->inexact (numerator (inexact->exact x)))
|
||||||
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)
|
||||||
(if (integer? x)
|
(if (integer? x)
|
||||||
1
|
1.0
|
||||||
(exact->inexact (ratio-denominator (inexact->exact x)))))))
|
(exact->inexact (denominator (inexact->exact x)))))))
|
||||||
(else
|
(else
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(complex
|
(complex
|
||||||
|
|
|
@ -676,6 +676,8 @@
|
||||||
(test 2.0 (denominator (inexact (/ 6 4))))
|
(test 2.0 (denominator (inexact (/ 6 4))))
|
||||||
(test 11.0 (numerator 5.5))
|
(test 11.0 (numerator 5.5))
|
||||||
(test 2.0 (denominator 5.5))
|
(test 2.0 (denominator 5.5))
|
||||||
|
(test 5.0 (numerator 5.0))
|
||||||
|
(test 1.0 (denominator 5.0))
|
||||||
|
|
||||||
(test -5.0 (floor -4.3))
|
(test -5.0 (floor -4.3))
|
||||||
(test -4.0 (ceiling -4.3))
|
(test -4.0 (ceiling -4.3))
|
||||||
|
|
Loading…
Add table
Reference in a new issue