RFR: 8271602: Add Math.ceilDiv() family parallel to Math.floorDiv() family

Brian Burkhalter bpb at openjdk.java.net
Thu Sep 9 23:48:06 UTC 2021


On Wed, 1 Sep 2021 20:13:38 GMT, Raffaello Giulietti <github.com+70726043+rgiulietti at openjdk.org> wrote:

> This PR ideally continues #5285, which has been closed as a consequence of inadvertently removing the branch on my repo. See there for initial discussion.
> 
> Sorry for the mess.

src/java.base/share/classes/java/lang/StrictMath.java line 1464:

> 1462:      * Returns the ceiling modulus of the {@code long} arguments.
> 1463:      * <p>
> 1464:      * The floor modulus is {@code r = x - (ceilDiv(x, y) * y)},

In line 1464 I think `floor` should be `ceiling`.

src/java.base/share/classes/java/lang/StrictMath.java line 1465:

> 1463:      * <p>
> 1464:      * The floor modulus is {@code r = x - (ceilDiv(x, y) * y)},
> 1465:      * has the same sign as the divisor {@code y} or is zero, and

In line 1465 I think `same` should be `opposite`.

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

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


More information about the core-libs-dev mailing list