RFR: 8271225: Add floorDivExact() method to java.lang.[Strict]Math

Brian Burkhalter bpb at openjdk.java.net
Thu Jul 29 23:33:42 UTC 2021


On Thu, 29 Jul 2021 23:27:32 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Add methods `floorDivExact(int,int)` and `floorDivExact(long,long)` to `java.lang.Math` and `java.lang.StrictMath`.

The `floorDivExact()` methods are identical to their `floorDiv()` counterparts aside from that they throw an `ArithmeticException` when the dividend is `MIN_VALUE` and the divisor is `-1`. These methods behave with respect to the methods `floorDiv()` as the methods `divideExact()` behave with respect to the division operator `/`.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4941


More information about the core-libs-dev mailing list