1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\begin{array}{l}
\mathbf{if}\;x \le -8.68169230986929577 \cdot 10^{-4}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\right)}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\\
\mathbf{elif}\;x \le 1.0867141534440548 \cdot 10^{-4}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.25, \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{3}}, 0.5 - \mathsf{fma}\left(0.5, \frac{1}{\sqrt{1}}, 0.1875 \cdot \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{5}}\right)\right)}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log \left(e^{\mathsf{fma}\left(-0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\right)}\right)}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\\
\end{array}double code(double x) {
return (1.0 - sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x))))));
}
double code(double x) {
double VAR;
if ((x <= -0.0008681692309869296)) {
VAR = (fma(-0.5, (1.0 + (1.0 / hypot(1.0, x))), (1.0 * 1.0)) / (1.0 + sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x)))))));
} else {
double VAR_1;
if ((x <= 0.00010867141534440548)) {
VAR_1 = (fma(0.25, (pow(x, 2.0) / pow(sqrt(1.0), 3.0)), (0.5 - fma(0.5, (1.0 / sqrt(1.0)), (0.1875 * (pow(x, 4.0) / pow(sqrt(1.0), 5.0)))))) / (1.0 + sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x)))))));
} else {
VAR_1 = (log(exp(fma(-0.5, (1.0 + (1.0 / hypot(1.0, x))), (1.0 * 1.0)))) / (1.0 + sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x)))))));
}
VAR = VAR_1;
}
return VAR;
}



Bits error versus x
Results
if x < -0.0008681692309869296Initial program 1.1
rmApplied flip--1.1
Simplified0.1
if -0.0008681692309869296 < x < 0.00010867141534440548Initial program 30.2
rmApplied flip--30.2
Simplified30.2
Taylor expanded around 0 30.2
Simplified0.2
if 0.00010867141534440548 < x Initial program 1.2
rmApplied flip--1.2
Simplified0.2
rmApplied add-log-exp0.2
Final simplification0.2
herbie shell --seed 2020102 +o rules:numerics
(FPCore (x)
:name "Given's Rotation SVD example, simplified"
:precision binary64
(- 1 (sqrt (* 0.5 (+ 1 (/ 1 (hypot 1 x)))))))