Fixes bug 173042: Wrong error message for (mod 3.0 3)

This commit is contained in:
Abdulaziz Ghuloum 2008-01-22 10:39:21 -05:00
parent 313e59bc92
commit 92d02e8e52
2 changed files with 20 additions and 13 deletions

View File

@ -2846,12 +2846,7 @@
b)]))
(define (div0-and-mod0 x y)
(define who 'div0-and-mod0)
(unless (integer? x)
(die who "not an integer" x))
(unless (and (integer? y) (not (= y 0)))
(die who "not an integer" y))
(let-values ([(d m) (div-and-mod x y)])
(let-values ([(d m) (div-and-mod* x y 'div0-and-mod0)])
(if (> y 0)
(if (< m (/ y 2))
(values d m)
@ -2861,13 +2856,25 @@
(values d m)))))
(define (div0 x y)
(let-values ([(n m) (div0-and-mod0 x y)])
n))
(let-values ([(d m) (div-and-mod* x y 'div0)])
(if (> y 0)
(if (< m (/ y 2))
d
(+ d 1))
(if (> m (/ y -2))
(- d 1)
d))))
(define (mod0 x y)
(let-values ([(n m) (div0-and-mod0 x y)])
m)))
(let-values ([(d m) (div-and-mod* x y 'mod0)])
(if (> y 0)
(if (< m (/ y 2))
m
(- m y))
(if (> m (/ y -2))
(+ m y)
m))))
)
(library (ikarus flonums div-and-mod)
(export fldiv flmod fldiv-and-mod fldiv0 flmod0 fldiv0-and-mod0)

View File

@ -1 +1 @@
1360
1361