File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
test/clojure/test_clojure Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,8 @@ public BigInt multiply(BigInt y) {
160160
161161public BigInt quotient (BigInt y ) {
162162 if ((bipart == null ) && (y .bipart == null )) {
163+ if (lpart == Long .MIN_VALUE && y .lpart == -1 )
164+ return BigInt .fromBigInteger (this .toBigInteger ().negate ());
163165 return BigInt .valueOf (lpart / y .lpart );
164166 }
165167 return BigInt .fromBigInteger (this .toBigInteger ().divide (y .toBigInteger ()));
Original file line number Diff line number Diff line change 300300 (is (thrown? ArithmeticException (/ 2 0 )))
301301 (is (thrown? IllegalArgumentException (/ ))) )
302302
303+ (deftest test-divide-bigint-at-edge
304+ (are [x] (= x (-' Long/MIN_VALUE))
305+ (/ Long/MIN_VALUE -1N )
306+ (/ (bigint Long/MIN_VALUE) -1 )
307+ (/ (bigint Long/MIN_VALUE) -1N )
308+ (quot Long/MIN_VALUE -1N )
309+ (quot (bigint Long/MIN_VALUE) -1 )
310+ (quot (bigint Long/MIN_VALUE) -1N )))
303311
304312; ; mod
305313; ; http://en.wikipedia.org/wiki/Modulo_operation
You can’t perform that action at this time.
0 commit comments