Minor exponent over/underflow problem in jsr13 BigDecimal pow(int) method

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 5.0
    • Affects Version/s: 5.0
    • Component/s: core-libs
    • tiger
    • generic
    • generic

      The pow(int) method added in jsr13 calculates the return value with

      return new BigDecimal(intVal.pow(n), scale * n);

      This scale calculation is not properly guarded against integer over/underflow, allowing for potentially very misleading results. Additionally, the calculation of 0^n should probably be special-cased.

            Assignee:
            Joe Darcy
            Reporter:
            Joe Darcy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: