Clojure

bigdec does not properly convert a clojure.lang.BigInt

Details

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

Description

bigdec handles java.math.BigInteger when converting to java.math.BigDecimal, but it does not handle clojure.lang.BigInt. Instead it treats a clojure.lang.BigInt as a Number, by casting it to long. This causes the following error:

Clojure 1.4.0-beta3
user=> (bigdec (inc (bigint Long/MAX_VALUE)))
IllegalArgumentException Value out of range for long: 9223372036854775808 clojure.lang.RT.longCast (RT.java:1123)

Activity

Andy Fingerhut made changes -
Field Original Value New Value
Attachment clj-952-make-bigdec-work-on-bigints-patch1.txt [ 10999 ]
Andy Fingerhut made changes -
Patch Code and Test [ 10002 ]
Alan Dipert made changes -
Approval Screened [ 10004 ]
Fix Version/s Release 1.5 [ 10150 ]
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
Stuart Halloway made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]

People

Vote (2)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: