Add unsignedMultiplyExact and *powExact methods to Math and StrictMath

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 25
    • Affects Version/s: None
    • Component/s: core-libs
    • b23

      Math (and StrictMath) offer signed `multiplyExact` methods that throw on overflow. However, there are no corresponding `unsignedMultiplyExact` methods. Since the conditions for overflow are different, the signed version cannot be just used as replacements.

      Further, there are no `powExact()` and `unsignedPowExact()` methods that operate on integer valued arguments. Similar methods are often implemented in ad-hoc ways, without checking for overflows. Thus, they silently return incorrect values, leading to the usual issues associated with overflowing arithmetic. The proposed methods provide a safe alternative.

            Assignee:
            Raffaello Giulietti
            Reporter:
            Raffaello Giulietti
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: