* Fixed bug 160101: modulo produces "BUG: unsupported"

This commit is contained in:
Abdulaziz Ghuloum 2007-11-05 02:24:39 -05:00
parent 6b40f525d9
commit 90a243ee63
3 changed files with 19 additions and 17 deletions

View File

@ -1240,10 +1240,17 @@
[(fixnum? m) [(fixnum? m)
(foreign-call "ikrt_bnfx_modulo" n m)] (foreign-call "ikrt_bnfx_modulo" n m)]
[(bignum? m) [(bignum? m)
(error 'modulo (if ($bignum-positive? n)
"BUG: two bignum arguments are not yet implemented" (if ($bignum-positive? m)
n m) (remainder n m)
(foreign-call "ikrt_bnbn_modulo" n m)] (+ m (remainder n m)))
(if ($bignum-positive? m)
(+ m (remainder n m))
(remainder n m)))]
;(error 'modulo
; "BUG: two bignum arguments are not yet implemented"
; n m)
;(foreign-call "ikrt_bnbn_modulo" n m)]
[(flonum? m) [(flonum? m)
(let ([v ($flonum->exact m)]) (let ([v ($flonum->exact m)])
(cond (cond

View File

@ -82,14 +82,14 @@
[(lambda (x) (= x -116479)) [(lambda (x) (= x -116479))
(modulo -536870912238479837489374 -324873)] (modulo -536870912238479837489374 -324873)]
; then make both arguments bignums ; then make both arguments bignums
;[(lambda (x) (= x 830066489308918857679)) [(lambda (x) (= x 830066489308918857679))
; (modulo 536870912238479837489374 3248732398479823749283)] (modulo 536870912238479837489374 3248732398479823749283)]
;[(lambda (x) (= x 2418665909170904891604)) [(lambda (x) (= x -2418665909170904891604))
; (modulo -536870912238479837489374 3248732398479823749283)] (modulo 536870912238479837489374 -3248732398479823749283)]
;[(lambda (x) (= x -2418665909170904891604)) [(lambda (x) (= x 2418665909170904891604))
; (modulo 536870912238479837489374 -3248732398479823749283)] (modulo -536870912238479837489374 3248732398479823749283)]
;[(lambda (x) (= x -830066489308918857679)) [(lambda (x) (= x -830066489308918857679))
; (modulo -536870912238479837489374 -3248732398479823749283)] (modulo -536870912238479837489374 -3248732398479823749283)]
)) ))

View File

@ -1464,11 +1464,6 @@ ikrt_bnfx_modulo(ikp x, ikp y, ikpcb* pcb){
} }
} }
ikp
ikrt_bnbn_modulo(ikp x, ikp y, ikpcb* pcb){
fprintf(stderr, "error in bnbnmodulo\n");
exit(-1);
}