On Thu, 29 Jul 2021 23:28:07 GMT, Brian Burkhalter <b...@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 `/`.

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

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

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

Reply via email to