RFR: 8075806: divideExact is missing in java.lang.Math
Joe Darcy
darcy at openjdk.java.net
Wed Jul 14 16:48:15 UTC 2021
On Tue, 13 Jul 2021 17:21:52 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Please consider this proposal to add `divideExact()` methods for integral data types to `java.lang.Math` thereby rounding out "exact" support to all four basic arithmetic operations.
Are there examples in the JDK or its tests where a method with this definition would be used?
src/java.base/share/classes/java/lang/Math.java line 1008:
> 1006: * Returns the quotient of the arguments, throwing an exception if the
> 1007: * result overflows an {@code int}. Such overflow can occur if and only
> 1008: * if either {@code y} is zero, or both {@code x} is
I think the divide by zero case should be discussed separately from overflow.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4770
More information about the core-libs-dev
mailing list