RFR: 8271225: Add floorDivExact() method to java.lang.[Strict]Math
Brian Burkhalter
bpb at openjdk.java.net
Tue Aug 3 16:16:29 UTC 2021
On Tue, 3 Aug 2021 08:42:18 GMT, Raffaello Giulietti <github.com+70726043+rgiulietti at openjdk.org> wrote:
>> 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 `/`.
>
> Hello @bplb,
>
> the doc of floorDivExact() is not, well..., exact.
>
> For example,
>> The floor rounding mode gives different results from truncation
> when the exact result is negative.
>
> The truth is that the results are different when the exact quotient _is not an integer and is negative_.
> The description following this sentence is imprecise as well.
>
> The doc seems to have been copied and adapted from the doc of floorDiv(), which is imprecise in the first place.
> You might want to take a look at [PR 4963](https://github.com/openjdk/jdk/pull/4963) which addresses this and wait until that one is thoroughly discussed for mathematical accuracy and correct wording.
>
>
> Greetings
> Raffaello
@rgiulietti Yes, that doc was copied. I tend to agree that it would be better to get 4963 right and hold off on this PR until then.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4941
More information about the core-libs-dev
mailing list