\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\begin{array}{l}
\mathbf{if}\;x \le -5.3888208797845926 \cdot 10^{-12}:\\
\;\;\;\;\sqrt{\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(e^{2 \cdot x} - 1\right)\right)}{\frac{\mathsf{fma}\left(-1, 1, e^{x + x}\right)}{e^{x} + 1}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(0.5, {x}^{2}, \mathsf{fma}\left(1, x, 2\right)\right)}\\
\end{array}double code(double x) {
return sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0)));
}
double code(double x) {
double temp;
if ((x <= -5.3888208797845926e-12)) {
temp = sqrt((expm1(log1p((exp((2.0 * x)) - 1.0))) / (fma(-1.0, 1.0, exp((x + x))) / (exp(x) + 1.0))));
} else {
temp = sqrt(fma(0.5, pow(x, 2.0), fma(1.0, x, 2.0)));
}
return temp;
}



Bits error versus x
Results
if x < -5.3888208797845926e-12Initial program 0.5
rmApplied flip--0.3
Simplified0.0
rmApplied expm1-log1p-u0.0
if -5.3888208797845926e-12 < x Initial program 35.8
Taylor expanded around 0 7.9
Simplified7.9
Final simplification0.9
herbie shell --seed 2020065 +o rules:numerics
(FPCore (x)
:name "sqrtexp (problem 3.4.4)"
:precision binary64
(sqrt (/ (- (exp (* 2 x)) 1) (- (exp x) 1))))