On 3/1/2023 8:16 AM, Raffaello Giulietti wrote:
On Wed, 1 Mar 2023 14:27:09 GMT, Andrey Turbanov <aturba...@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 814:
812:
813: static final double
814: twon24 = 0x1.0p-24; // 5.96046447753906250000e-08
Suggestion:
twon24 = 0x1.0p-24; // 5.96046447753906250000e-08
Would it be worthwhile to declare this as a compile time constant, similarly to
`TWO24`? If it's used only here, then probably not.
That particular constant is only used to implement one method. SinceĀ
TWO24 is used in two of the methods being ported in this PR, I pulled it
out. (As I may have mentioned before, once all the FDLIBM methods are
ported, I plan to make a few cleanup passes over the code, including
pulling out any other common constants, etc.)
-Joe