Uploaded image for project: 'Clojure'
  1. CLJ-952

bigdec does not properly convert a clojure.lang.BigInt

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: Release 1.4, Release 1.3
    • Fix versions: Release 1.5
    • Labels:
      None
    • Approval:
      Ok
    • Patch:
      Code and Test

      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)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              pjstadig Paul Stadig
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: