1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\begin{array}{l}
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \le 1.0000000304944825:\\
\;\;\;\;\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{\mathsf{fma}\left(-0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\right)}{\left(\sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}} \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right)\right)\right) \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right)\right)}\\
\end{array}double code(double x) {
return ((double) (1.0 - ((double) sqrt(((double) (0.5 * ((double) (1.0 + ((double) (1.0 / ((double) hypot(1.0, x))))))))))));
}
double code(double x) {
double VAR;
if ((((double) hypot(1.0, x)) <= 1.0000000304944825)) {
VAR = ((double) (((double) fma(0.25, ((double) (((double) pow(x, 2.0)) / ((double) pow(((double) sqrt(1.0)), 3.0)))), ((double) (0.5 - ((double) fma(0.5, ((double) (1.0 / ((double) sqrt(1.0)))), ((double) (0.1875 * ((double) (((double) pow(x, 4.0)) / ((double) pow(((double) sqrt(1.0)), 5.0)))))))))))) / ((double) (1.0 + ((double) sqrt(((double) (0.5 * ((double) (1.0 + ((double) (1.0 / ((double) hypot(1.0, x))))))))))))));
} else {
VAR = ((double) (((double) fma(((double) -(0.5)), ((double) (1.0 + ((double) (1.0 / ((double) hypot(1.0, x)))))), ((double) (1.0 * 1.0)))) / ((double) (((double) (((double) cbrt(((double) (1.0 + ((double) sqrt(((double) (0.5 * ((double) (1.0 + ((double) (1.0 / ((double) hypot(1.0, x)))))))))))))) * ((double) expm1(((double) log1p(((double) cbrt(((double) (1.0 + ((double) sqrt(((double) (0.5 * ((double) (1.0 + ((double) (1.0 / ((double) hypot(1.0, x)))))))))))))))))))) * ((double) expm1(((double) log1p(((double) cbrt(((double) (1.0 + ((double) sqrt(((double) (0.5 * ((double) (1.0 + ((double) (1.0 / ((double) hypot(1.0, x))))))))))))))))))))));
}
return VAR;
}



Bits error versus x
Results
if (hypot 1.0 x) < 1.0000000304944825Initial program 31.2
rmApplied flip--31.2
Simplified31.2
Taylor expanded around 0 31.2
Simplified0.2
if 1.0000000304944825 < (hypot 1.0 x) Initial program 1.1
rmApplied flip--1.1
Simplified0.2
rmApplied add-cube-cbrt0.2
rmApplied expm1-log1p-u0.2
rmApplied expm1-log1p-u0.2
Final simplification0.2
herbie shell --seed 2020113 +o rules:numerics
(FPCore (x)
:name "Given's Rotation SVD example, simplified"
:precision binary64
(- 1 (sqrt (* 0.5 (+ 1 (/ 1 (hypot 1 x)))))))