Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4916097

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 5.0
    • 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.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: