fixed error in division in (/ 0 <bignum>)
This commit is contained in:
parent
4ca8b1add2
commit
7d6316f723
|
@ -1233,20 +1233,22 @@
|
||||||
(binary- 0 (fxquotient x g))
|
(binary- 0 (fxquotient x g))
|
||||||
(binary- 0 (fxquotient y g)))])))])]
|
(binary- 0 (fxquotient y g)))])))])]
|
||||||
[(bignum? y)
|
[(bignum? y)
|
||||||
(let ([g (binary-gcd x y)])
|
(if ($fx= x 0)
|
||||||
(cond
|
0
|
||||||
[(= g y) (quotient x g)] ;;; should not happen
|
(let ([g (binary-gcd x y)])
|
||||||
[($bignum-positive? y)
|
(cond
|
||||||
(if ($fx= g 1)
|
[(= g y) (quotient x g)]
|
||||||
($make-ratnum x y)
|
[($bignum-positive? y)
|
||||||
($make-ratnum (fxquotient x g) (quotient y g)))]
|
(if ($fx= g 1)
|
||||||
[else
|
($make-ratnum x y)
|
||||||
(if ($fx= g 1)
|
($make-ratnum (fxquotient x g) (quotient y g)))]
|
||||||
($make-ratnum (binary- 0 x) (binary- 0 y))
|
[else
|
||||||
($make-ratnum
|
(if ($fx= g 1)
|
||||||
(binary- 0 (fxquotient x g))
|
($make-ratnum (binary- 0 x) (binary- 0 y))
|
||||||
(binary- 0 (quotient y g))))]))]
|
($make-ratnum
|
||||||
[(ratnum? y)
|
(binary- 0 (fxquotient x g))
|
||||||
|
(binary- 0 (quotient y g))))])))]
|
||||||
|
[(ratnum? y)
|
||||||
(/ (* x ($ratnum-d y)) ($ratnum-n y))]
|
(/ (* x ($ratnum-d y)) ($ratnum-n y))]
|
||||||
[(or (compnum? y) (cflonum? y)) (x/compy x y)]
|
[(or (compnum? y) (cflonum? y)) (x/compy x y)]
|
||||||
[else (err '/ y)])]
|
[else (err '/ y)])]
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1753
|
1754
|
||||||
|
|
Loading…
Reference in New Issue