1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\begin{array}{l}
\mathbf{if}\;x \le -0.00259817078668467217:\\
\;\;\;\;\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(-0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot 1\right)\right)\right)}{1 + \frac{\sqrt{0.5 \cdot \left({1}^{3} + {\left(\frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}^{3}\right)}}{\sqrt{1 \cdot 1 + \left(\frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)} - 1 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}\\
\mathbf{elif}\;x \le 3.5149209891470142 \cdot 10^{-4}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)}{1 + \frac{\sqrt{0.5 \cdot \left({1}^{3} + {\left(\frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}^{3}\right)}}{\sqrt{1 \cdot 1 + \left(\frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)} - 1 \cdot \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)}{1 + \frac{\sqrt{0.5 \cdot \left({1}^{3} + {\left(\frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}^{3}\right)}}{\sqrt{1 \cdot 1 + \left(\frac{1}{\mathsf{hypot}\left(1, x\right)} \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)} - 1 \cdot \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}\\
\end{array}double f(double x) {
double r313703 = 1.0;
double r313704 = 0.5;
double r313705 = x;
double r313706 = hypot(r313703, r313705);
double r313707 = r313703 / r313706;
double r313708 = r313703 + r313707;
double r313709 = r313704 * r313708;
double r313710 = sqrt(r313709);
double r313711 = r313703 - r313710;
return r313711;
}
double f(double x) {
double r313712 = x;
double r313713 = -0.002598170786684672;
bool r313714 = r313712 <= r313713;
double r313715 = 0.5;
double r313716 = -r313715;
double r313717 = 1.0;
double r313718 = hypot(r313717, r313712);
double r313719 = r313717 / r313718;
double r313720 = r313717 + r313719;
double r313721 = r313717 * r313717;
double r313722 = fma(r313716, r313720, r313721);
double r313723 = log1p(r313722);
double r313724 = expm1(r313723);
double r313725 = 3.0;
double r313726 = pow(r313717, r313725);
double r313727 = pow(r313719, r313725);
double r313728 = r313726 + r313727;
double r313729 = r313715 * r313728;
double r313730 = sqrt(r313729);
double r313731 = r313719 * r313719;
double r313732 = r313717 * r313719;
double r313733 = r313731 - r313732;
double r313734 = r313721 + r313733;
double r313735 = sqrt(r313734);
double r313736 = r313730 / r313735;
double r313737 = r313717 + r313736;
double r313738 = r313724 / r313737;
double r313739 = 0.0003514920989147014;
bool r313740 = r313712 <= r313739;
double r313741 = 0.25;
double r313742 = 2.0;
double r313743 = pow(r313712, r313742);
double r313744 = sqrt(r313717);
double r313745 = pow(r313744, r313725);
double r313746 = r313743 / r313745;
double r313747 = 1.0;
double r313748 = r313747 / r313744;
double r313749 = 0.1875;
double r313750 = 4.0;
double r313751 = pow(r313712, r313750);
double r313752 = 5.0;
double r313753 = pow(r313744, r313752);
double r313754 = r313751 / r313753;
double r313755 = r313749 * r313754;
double r313756 = fma(r313715, r313748, r313755);
double r313757 = r313715 - r313756;
double r313758 = fma(r313741, r313746, r313757);
double r313759 = log1p(r313758);
double r313760 = expm1(r313759);
double r313761 = r313760 / r313737;
double r313762 = r313722 / r313737;
double r313763 = r313740 ? r313761 : r313762;
double r313764 = r313714 ? r313738 : r313763;
return r313764;
}



Bits error versus x
if x < -0.002598170786684672Initial program 1.0
rmApplied flip--1.0
Simplified0.1
rmApplied flip3-+0.1
Applied associate-*r/0.1
Applied sqrt-div0.1
rmApplied expm1-log1p-u0.1
if -0.002598170786684672 < x < 0.0003514920989147014Initial program 30.4
rmApplied flip--30.4
Simplified30.4
rmApplied flip3-+30.4
Applied associate-*r/30.4
Applied sqrt-div30.4
rmApplied expm1-log1p-u30.4
Taylor expanded around 0 30.4
Simplified0.2
if 0.0003514920989147014 < x Initial program 1.1
rmApplied flip--1.1
Simplified0.1
rmApplied flip3-+0.1
Applied associate-*r/0.1
Applied sqrt-div0.1
Final simplification0.1
herbie shell --seed 2020018 +o rules:numerics
(FPCore (x)
:name "Given's Rotation SVD example, simplified"
:precision binary64
(- 1 (sqrt (* 0.5 (+ 1 (/ 1 (hypot 1 x)))))))