\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}\begin{array}{l}
\mathbf{if}\;x \le -0.005609947366707223291582007362876538536511:\\
\;\;\;\;\log \left(e^{\tanh x}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({x}^{3}, \frac{-1}{3}, \mathsf{fma}\left(\frac{2}{15}, {x}^{5}, x\right)\right)\\
\end{array}double f(double x) {
double r51546 = x;
double r51547 = exp(r51546);
double r51548 = -r51546;
double r51549 = exp(r51548);
double r51550 = r51547 - r51549;
double r51551 = r51547 + r51549;
double r51552 = r51550 / r51551;
return r51552;
}
double f(double x) {
double r51553 = x;
double r51554 = -0.005609947366707223;
bool r51555 = r51553 <= r51554;
double r51556 = tanh(r51553);
double r51557 = exp(r51556);
double r51558 = log(r51557);
double r51559 = 3.0;
double r51560 = pow(r51553, r51559);
double r51561 = -0.3333333333333333;
double r51562 = 0.13333333333333333;
double r51563 = 5.0;
double r51564 = pow(r51553, r51563);
double r51565 = fma(r51562, r51564, r51553);
double r51566 = fma(r51560, r51561, r51565);
double r51567 = r51555 ? r51558 : r51566;
return r51567;
}



Bits error versus x
if x < -0.005609947366707223Initial program 36.1
rmApplied tanh-undef0.1
rmApplied add-log-exp0.5
if -0.005609947366707223 < x Initial program 58.6
rmApplied tanh-undef0.0
Taylor expanded around 0 1.0
Simplified1.0
Final simplification1.0
herbie shell --seed 2019322 +o rules:numerics
(FPCore (x)
:name "Hyperbolic tangent"
:precision binary64
(/ (- (exp x) (exp (- x))) (+ (exp x) (exp (- x)))))