RFR: JDK-8302040: Port fdlibm sqrt to Java

Raffaello Giulietti rgiulietti at openjdk.org
Fri Feb 24 13:39:19 UTC 2023


On Thu, 23 Feb 2023 23:28:11 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> The wheel of FDLIBM porting turns a notch and sqrt comes into play.
> 
> While the sqrt operation usually has a hardware implementation that is intrinsified, for completeness a software implementation should be available as well.

Otherwise LGTM

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

> 657:                     q1  += r;
> 658:                 }
> 659:                 ix0 += ix0 + ((ix1 & sign) >>> 31);

You may want to add the traditional `// unsigned shift` comment even here, just to be consistent.

test/jdk/java/lang/StrictMath/ExhaustingTests.java line 71:

> 69:             // Since sqrt is correctly rounded, could additionaly the
> 70:             // transliteration or StrictMath sqrt methods to against
> 71:             // Math::sqrt.

I guess this comment has been messed up by some copy&paste activities?
Or is it a ChatGPT output?

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

> 651:                     q1  += r;
> 652:                 }
> 653:                 ix0 += ix0 + ((ix1&sign)>>>31);

You may want to add the traditional `// unsigned shift` comment even here, just to be consistent.

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

PR: https://git.openjdk.org/jdk/pull/12736


More information about the core-libs-dev mailing list