Clojure

BigInt optimization breaks "obvious" math

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.3
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test
  • Approval:
    Ok

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.

Activity

Hide
Stuart Halloway added a comment -

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.

Show
Stuart Halloway added a comment - 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.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: