1 - \sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\begin{array}{l}
\mathbf{if}\;x \le -0.010462939647205145:\\
\;\;\;\;\frac{\frac{1}{2} - \frac{\frac{1}{2}}{\mathsf{hypot}\left(1, x\right)}}{\mathsf{hypot}\left(\left(\sqrt{\frac{\frac{1}{2}}{\mathsf{hypot}\left(1, x\right)}}\right), \left(\sqrt{\frac{1}{2}}\right)\right) + 1}\\
\mathbf{elif}\;x \le 0.008896625846513824:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{8}, \left(x \cdot x\right), \left(\mathsf{fma}\left(\left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right), \frac{69}{1024}, \left(\frac{-11}{128} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{2} - \frac{\frac{1}{2}}{\mathsf{hypot}\left(1, x\right)}}{\mathsf{hypot}\left(\left(\sqrt{\frac{\frac{1}{2}}{\mathsf{hypot}\left(1, x\right)}}\right), \left(\sqrt{\frac{1}{2}}\right)\right) + 1}\\
\end{array}double f(double x) {
double r4036577 = 1.0;
double r4036578 = 0.5;
double r4036579 = x;
double r4036580 = hypot(r4036577, r4036579);
double r4036581 = r4036577 / r4036580;
double r4036582 = r4036577 + r4036581;
double r4036583 = r4036578 * r4036582;
double r4036584 = sqrt(r4036583);
double r4036585 = r4036577 - r4036584;
return r4036585;
}
double f(double x) {
double r4036586 = x;
double r4036587 = -0.010462939647205145;
bool r4036588 = r4036586 <= r4036587;
double r4036589 = 0.5;
double r4036590 = 1.0;
double r4036591 = hypot(r4036590, r4036586);
double r4036592 = r4036589 / r4036591;
double r4036593 = r4036589 - r4036592;
double r4036594 = sqrt(r4036592);
double r4036595 = sqrt(r4036589);
double r4036596 = hypot(r4036594, r4036595);
double r4036597 = r4036596 + r4036590;
double r4036598 = r4036593 / r4036597;
double r4036599 = 0.008896625846513824;
bool r4036600 = r4036586 <= r4036599;
double r4036601 = 0.125;
double r4036602 = r4036586 * r4036586;
double r4036603 = r4036602 * r4036602;
double r4036604 = r4036602 * r4036603;
double r4036605 = 0.0673828125;
double r4036606 = -0.0859375;
double r4036607 = r4036606 * r4036603;
double r4036608 = fma(r4036604, r4036605, r4036607);
double r4036609 = fma(r4036601, r4036602, r4036608);
double r4036610 = r4036600 ? r4036609 : r4036598;
double r4036611 = r4036588 ? r4036598 : r4036610;
return r4036611;
}



Bits error versus x
if x < -0.010462939647205145 or 0.008896625846513824 < x Initial program 1.0
Simplified1.0
rmApplied flip--1.0
Simplified0.1
rmApplied add-sqr-sqrt0.1
Applied add-sqr-sqrt0.1
Applied hypot-def0.1
if -0.010462939647205145 < x < 0.008896625846513824Initial program 30.5
Simplified30.5
rmApplied flip--30.5
Simplified30.5
Taylor expanded around 0 0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2019132 +o rules:numerics
(FPCore (x)
:name "Given's Rotation SVD example, simplified"
(- 1 (sqrt (* 1/2 (+ 1 (/ 1 (hypot 1 x)))))))