RFR: JDK-8304028: Port fdlibm IEEEremainder to Java

Raffaello Giulietti rgiulietti at openjdk.org
Mon Mar 27 10:17:33 UTC 2023


On Tue, 21 Mar 2023 06:11:57 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> Last but not least, a port of fdlibm IEEEremainder from C to Java. I plan to write some more implementation-specific tests around decision points in the FDLIBM algorithm, but I wanted to get the bulk of the changes out for review first.
> 
> Note that since IEEEremainder was the last native method in StrictMath.java, the StrictMath.c file needed to be deleted (or modified) since StrictMath.h was no longer generated as part of the build. (StrictMath.c was one of the file deleted as part of JDK-8302801).
> 
> For testing, Mach 5 tier 1 through 3 were successful (other than an unrelated test failure that was problem listed) and the exhaustive test was locally run and passed with "16, 16" to increase the testing density.

src/java.base/share/classes/java/lang/FdLibm.java line 3331:

> 3329: 
> 3330:             if (hp <= 0x7fdf_ffff) {  // now x < 2p
> 3331:                 x = __ieee754_fmod(x, p + p);

if (hp <= 0x7fdf_ffff) {
                x = __ieee754_fmod(x, p + p);  // now x < 2p

src/java.base/share/classes/java/lang/FdLibm.java line 3372:

> 3370:             // purge off exception values
> 3371:             if((hy | ly) == 0 || (hx >= 0x7ff0_0000)||       // y = 0, or x not finite
> 3372:                ((hy | ((ly | -ly) >> 31)) > 0x7ff0_0000))    // or y is NaN

Suggestion:

               ((hy | ((ly | -ly) >>> 31)) > 0x7ff0_0000))    // or y is NaN, unsigned shift

test/jdk/java/lang/StrictMath/FdlibmTranslit.java line 2652:

> 2650:             /* purge off exception values */
> 2651:             if((hy|ly)==0||(hx>=0x7ff00000)||       /* y=0,or x not finite */
> 2652:                ((hy|((ly|-ly)>>31))>0x7ff00000))     /* or y is NaN */

Suggestion:

               ((hy|((ly|-ly)>>>31))>0x7ff00000))     /* or y is NaN */

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13113#discussion_r1149070401
PR Review Comment: https://git.openjdk.org/jdk/pull/13113#discussion_r1149074081
PR Review Comment: https://git.openjdk.org/jdk/pull/13113#discussion_r1149058824


More information about the core-libs-dev mailing list