Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8679

BigDecimalMath.MAX_DIVISION_SCALE is hard-coded

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.1, 3.0.0-alpha-4
    • Component/s: None
    • Labels:
      None

      Description

      https://github.com/apache/groovy/pull/762

      The "scale" for BigDecimal division is hard-coded to 10 (BigDecimalMath.MAX_DIVISION_SCALE), which is fewer than the roughly equivalent 16-17 digits for double (64-bit) division. It seems like the default scale should be at least as accurate as double division. Also it is probably desirable for this setting to be configurable in some way, maybe more than one. Maybe a global Java system property setting, and then some form of context related override (per-thread, per-script, etc.).

      I use this fix for 2 years without side effects on a software for a big company. For comparison, Excel use a round with 15 digit after decimal

        Attachments

          Activity

            People

            • Assignee:
              daniel_sun Daniel Sun
              Reporter:
              daniel_sun Daniel Sun
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: