On Wed, 1 Mar 2023 05:28:34 GMT, Joe Darcy <da...@openjdk.org> wrote:
> Last and certainly not least in the port of FDLIBM to Java, the > transcendental methods for sin, cos, and tan. > > Some more tests are to be written in the StrictMath directory to verify that > the StrictMath algorihtm for sin/cos/tan is being used rather than a > different one. However, I wanted to get the rest of the change out for review > first. > > The sin/cos/tan methods are grouped together since they share the same > argument reduction logic. Argument reduction is the process of mapping an > argument of a function to an argument in a restricted range (and possibly > returning some function of the reduced argument). For sin, cos, and tan, > since they are fundamentally periodic with respect to a multiple of pi, > argument reduction is done to find the remainder of the original argument > with respect to pi/2. src/java.base/share/classes/java/lang/FdLibm.java line 519: > 517: // compute -1.0/(x + r) accurately > 518: double a,t; > 519: z = w; Suggestion: z = w; src/java.base/share/classes/java/lang/FdLibm.java line 521: > 519: z = w; > 520: z = __LO(z, 0); > 521: v = r - (z - x); // z + v = r + x Suggestion: v = r - (z - x); // z + v = r + x src/java.base/share/classes/java/lang/FdLibm.java line 524: > 522: t = a = -1.0/w; // a = -1.0/w > 523: t = __LO(t, 0); > 524: s = 1.0 + t*z; Suggestion: s = 1.0 + t*z; src/java.base/share/classes/java/lang/FdLibm.java line 641: > 639: w = fn*pio2_3; > 640: r = t - w; > 641: w = fn*pio2_3t - ((t - r) - w); let's either align assignments with following `y[0] = r - w;` or remove redundant space before `=` src/java.base/share/classes/java/lang/FdLibm.java line 664: > 662: // set z = scalbn(|x|,ilogb(x)-23) > 663: z = __LO(z, __LO(x)); > 664: e0 = (ix >> 20) - 1046; /* e0 = ilogb(z)-23; */ Suggestion: e0 = (ix >> 20) - 1046; /* e0 = ilogb(z)-23; */ ------------- PR: https://git.openjdk.org/jdk/pull/12800