@@ -1574,7 +1574,6 @@ tanh_cody_waite_impl(__ESIMD_NS::simd<float, N> x) {
1574
1574
constexpr float xsmall = 4 .22863966691620432990E-04f ;
1575
1575
constexpr float xmedium = 0 .54930614433405484570f ;
1576
1576
constexpr float xlarge = 8 .66433975699931636772f ;
1577
- constexpr float log2E = 1 .442695f ; // same as esimd::log(e)
1578
1577
1579
1578
using RT = __ESIMD_NS::simd<float , N>;
1580
1579
@@ -1591,7 +1590,7 @@ tanh_cody_waite_impl(__ESIMD_NS::simd<float, N> x) {
1591
1590
1592
1591
RT res;
1593
1592
res.merge (sign, x, isLarge);
1594
- auto temp = __ESIMD_NS::exp (absX * 2 .0f * log2E ) + 1 .f ;
1593
+ auto temp = __ESIMD_NS::exp (absX * 2 .0f ) + 1 .f ;
1595
1594
temp = ((temp - 2 .f ) / temp) * sign;
1596
1595
res.merge (temp, isGtMed);
1597
1596
res.merge ((absX + absX * g * (g * p1 + p0) / (g + q0)) * sign, isGtSmall);
@@ -1609,8 +1608,7 @@ tanh_impl(__ESIMD_NS::simd<float, N> x) {
1609
1608
*/
1610
1609
1611
1610
constexpr float xsmall = 0 .000045f ; // same as exp(-10.0f)
1612
- constexpr float xlarge = 88 .f ;
1613
- constexpr float log2E = 1 .442695f ; // same as esimd::log(e)
1611
+ constexpr float xlarge = 40 .f ;
1614
1612
1615
1613
using RT = __ESIMD_NS::simd<float , N>;
1616
1614
@@ -1626,7 +1624,7 @@ tanh_impl(__ESIMD_NS::simd<float, N> x) {
1626
1624
res.merge (sign, x, isLarge);
1627
1625
1628
1626
RT exp;
1629
- exp = __ESIMD_NS::exp (absX * 2 .f * log2E );
1627
+ exp = __ESIMD_NS::exp (absX * 2 .f );
1630
1628
1631
1629
res.merge (((exp - 1 .f ) / (exp + 1 .f )) * sign, (absX > xsmall) & isLessE);
1632
1630
0 commit comments