RFR: JDK-8302040: Port fdlibm sqrt to Java [v3]
Andrey Turbanov
aturbanov at openjdk.org
Sat Feb 25 18:10:10 UTC 2023
On Fri, 24 Feb 2023 18:40:38 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.
>
> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision:
>
> Add one one unsigned shift comment.
src/java.base/share/classes/java/lang/FdLibm.java line 600:
> 598:
> 599: // take care of Inf and NaN
> 600: if((ix0 & 0x7ff0_0000) == 0x7ff0_0000) {
Suggestion:
if ((ix0 & 0x7ff0_0000) == 0x7ff0_0000) {
src/java.base/share/classes/java/lang/FdLibm.java line 639:
> 637: r = 0x0020_0000; // r = moving bit from right to left
> 638:
> 639: while(r != 0) {
Suggestion:
while (r != 0) {
src/java.base/share/classes/java/lang/FdLibm.java line 641:
> 639: while(r != 0) {
> 640: t = s0 + r;
> 641: if(t <= ix0) {
Suggestion:
if (t <= ix0) {
src/java.base/share/classes/java/lang/FdLibm.java line 655:
> 653: t1 = s1 + r;
> 654: t = s0;
> 655: if((t < ix0) ||
Suggestion:
if ((t < ix0) ||
src/java.base/share/classes/java/lang/FdLibm.java line 657:
> 655: if((t < ix0) ||
> 656: ((t == ix0) && (Integer.compareUnsigned(t1, ix1) <= 0 ))) { // t1 <= ix1
> 657: s1 = t1 + r;
Suggestion:
s1 = t1 + r;
-------------
PR: https://git.openjdk.org/jdk/pull/12736
More information about the core-libs-dev
mailing list