\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}\mathsf{expm1}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{log1p}\left(\mathsf{fma}\left({x}^{5}, \frac{2}{15}, x - \frac{1}{3} \cdot {x}^{3}\right)\right)\right)\right)\right)double f(double x) {
double r43214 = x;
double r43215 = exp(r43214);
double r43216 = -r43214;
double r43217 = exp(r43216);
double r43218 = r43215 - r43217;
double r43219 = r43215 + r43217;
double r43220 = r43218 / r43219;
return r43220;
}
double f(double x) {
double r43221 = x;
double r43222 = 5.0;
double r43223 = pow(r43221, r43222);
double r43224 = 0.13333333333333333;
double r43225 = 0.3333333333333333;
double r43226 = 3.0;
double r43227 = pow(r43221, r43226);
double r43228 = r43225 * r43227;
double r43229 = r43221 - r43228;
double r43230 = fma(r43223, r43224, r43229);
double r43231 = log1p(r43230);
double r43232 = log1p(r43231);
double r43233 = expm1(r43232);
double r43234 = expm1(r43233);
return r43234;
}



Bits error versus x
Initial program 57.8
Simplified0.7
Taylor expanded around 0 1.9
Simplified1.9
rmApplied expm1-log1p-u2.0
rmApplied expm1-log1p-u2.0
Final simplification2.0
herbie shell --seed 2020049 +o rules:numerics
(FPCore (x)
:name "Hyperbolic tangent"
:precision binary64
(/ (- (exp x) (exp (- x))) (+ (exp x) (exp (- x)))))