RFR: 8271601: Math.floorMod(int, int) and Math.floorMod(long, long) differ in their logic
Brian Burkhalter
bpb at openjdk.java.net
Mon Aug 2 22:49:30 UTC 2021
On Mon, 2 Aug 2021 19:59:57 GMT, Raffaello Giulietti <github.com+70726043+rgiulietti at openjdk.org> wrote:
> Hello,
>
> please review this tiny change in the implementation of j.l.Math.floorMod(int, int).
>
> While the results are unaffected, all of
> floorDiv(int, int)
> floorDiv(long, long)
> floorMod(long, long)
> use x ^ y in the tests to correct the result if needed.
>
> Not only is the proposed change more consistent with the other methods, but it might benefit later stages in the cpu to proceed with the evaluation of x ^ y in parallel with the previous x % y and, depending of the outcome, even further down.
>
>
> Greetings
> Raffaello
This looks all right to me. Verified by running all `java/lang/Math` tests against the patch.
-------------
Marked as reviewed by bpb (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/4962
More information about the core-libs-dev
mailing list