Fixes bug 173042: Wrong error message for (mod 3.0 3)
This commit is contained in:
parent
313e59bc92
commit
92d02e8e52
|
@ -2846,12 +2846,7 @@
|
||||||
b)]))
|
b)]))
|
||||||
|
|
||||||
(define (div0-and-mod0 x y)
|
(define (div0-and-mod0 x y)
|
||||||
(define who 'div0-and-mod0)
|
(let-values ([(d m) (div-and-mod* x y '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)])
|
|
||||||
(if (> y 0)
|
(if (> y 0)
|
||||||
(if (< m (/ y 2))
|
(if (< m (/ y 2))
|
||||||
(values d m)
|
(values d m)
|
||||||
|
@ -2861,13 +2856,25 @@
|
||||||
(values d m)))))
|
(values d m)))))
|
||||||
|
|
||||||
(define (div0 x y)
|
(define (div0 x y)
|
||||||
(let-values ([(n m) (div0-and-mod0 x y)])
|
(let-values ([(d m) (div-and-mod* x y 'div0)])
|
||||||
n))
|
(if (> y 0)
|
||||||
|
(if (< m (/ y 2))
|
||||||
|
d
|
||||||
|
(+ d 1))
|
||||||
|
(if (> m (/ y -2))
|
||||||
|
(- d 1)
|
||||||
|
d))))
|
||||||
|
|
||||||
(define (mod0 x y)
|
(define (mod0 x y)
|
||||||
(let-values ([(n m) (div0-and-mod0 x y)])
|
(let-values ([(d m) (div-and-mod* x y 'mod0)])
|
||||||
m)))
|
(if (> y 0)
|
||||||
|
(if (< m (/ y 2))
|
||||||
|
m
|
||||||
|
(- m y))
|
||||||
|
(if (> m (/ y -2))
|
||||||
|
(+ m y)
|
||||||
|
m))))
|
||||||
|
)
|
||||||
|
|
||||||
(library (ikarus flonums div-and-mod)
|
(library (ikarus flonums div-and-mod)
|
||||||
(export fldiv flmod fldiv-and-mod fldiv0 flmod0 fldiv0-and-mod0)
|
(export fldiv flmod fldiv-and-mod fldiv0 flmod0 fldiv0-and-mod0)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1360
|
1361
|
||||||
|
|
Loading…
Reference in New Issue