On Fri, 30 Aug 2024 20:26:05 GMT, Srinivas Vamsi Parasa <[email protected]>
wrote:
>> The goal of this PR is to implement an x86_64 intrinsic for
>> java.lang.Math.tanh() using libm
>>
>> Benchmark (ops/ms) | Stock JDK | Tanh intrinsic | Speedup
>> -- | -- | -- | --
>> MathBench.tanhDouble | 70900 | 95618 | 1.35x
>
> Srinivas Vamsi Parasa has updated the pull request incrementally with one
> additional commit since the last revision:
>
> Add stub initialization and extra tanh tests
test/jdk/java/lang/Math/HyperbolicTests.java line 1009:
> 1007: for(int i = 0; i < testCases.length; i++) {
> 1008: double testCase = testCases[i];
> 1009: failures += testTanhWithReferenceUlpDiff(testCase,
> StrictMath.tanh(testCase), 2.5);
The allowable worst-case error is 2.5 ulp, although at many arguments FDLIBM
has a smaller error.
For a general Math vs StrictMath test with an allowable 2.5 ulp error, without
knowing how accurate FDLIBM is for that function and argument, a large error of
approx. 2X the nominal error should be allowed (in case FDLIBM errors in one
direction and the Math method errors in the other direction).
If the test is going to use randomness, then its jtreg tags should include
`@key randomness`
and it is preferable to use jdk.test.lib.RandomFactory to get and Random object
since that handles printing out a key so the random sequence can be replicated
if the test fails.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20657#discussion_r1742826418