BigInt optimization breaks "obvious" math

Description

BigInt optimization seems seriously broken:

user=> (def a 1N)
#'user/a
user=> (* (+ a 10000000000000000) (+ a 10000000000000000))
ArithmeticException integer overflow
clojure.lang.Numbers.throwIntOverflow (Numbers.java:1374)

A BigInt is optimized back to a long and then overflows which is not
what happened in Beta1 and earlier.

Environment

None

Attachments

1
  • 07 Sep 2011, 12:10 AM

Activity

Show:

Stuart HallowaySeptember 7, 2011 at 12:10 AM

Please see https://github.com/clojure/test.generative/commit/9a23bc4c8a713c690e5ac7d5377f7bad861e7489 for a partial regression test. I am going to continue to expand the test but wanted to get this patch in asap.

Completed

Details

Assignee

Reporter

Approval

Ok

Patch

Code and Test

Priority

Fix versions

Created September 6, 2011 at 8:43 AM
Updated September 23, 2011 at 10:00 PM
Resolved September 23, 2011 at 10:00 PM

Flag notifications