RFR: 8338694: x86_64 intrinsic for tanh using libm [v2]

Joe Darcy darcy at openjdk.org
Tue Sep 3 22:58:22 UTC 2024


On Fri, 30 Aug 2024 20:26:05 GMT, Srinivas Vamsi Parasa <duke at openjdk.org> 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 984:

> 982:         double b1 = 0.02;
> 983:         double b2 = 5.1;
> 984:         double b3 = 55 * Math.log(2)/2; // ~19.062

Probably better to use StrictMath.log here or, better use, precompute the value as a constant and document its conceptual origin.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20657#discussion_r1742790463


More information about the core-libs-dev mailing list