Average Error: 15.9 → 0.2
Time: 10.0s
Precision: 64
\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.332210515937476582107312772507157205837 \cdot 10^{-4}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.5, 1 + \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\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 \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right) \cdot \left(\sqrt[3]{\sqrt{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}} \cdot \sqrt[3]{\sqrt{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}\right)}\\ \mathbf{elif}\;x \le 0.001355191534922870703200326047976886911783:\\ \;\;\;\;\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{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\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 \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right) \cdot {\left(1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{\frac{1}{3}}}\\ \end{array}\]
1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\begin{array}{l}
\mathbf{if}\;x \le -7.332210515937476582107312772507157205837 \cdot 10^{-4}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.5, 1 + \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\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 \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right) \cdot \left(\sqrt[3]{\sqrt{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}} \cdot \sqrt[3]{\sqrt{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}\right)}\\

\mathbf{elif}\;x \le 0.001355191534922870703200326047976886911783:\\
\;\;\;\;\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{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\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 \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right) \cdot {\left(1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{\frac{1}{3}}}\\

\end{array}
double f(double x) {
        double r253275 = 1.0;
        double r253276 = 0.5;
        double r253277 = x;
        double r253278 = hypot(r253275, r253277);
        double r253279 = r253275 / r253278;
        double r253280 = r253275 + r253279;
        double r253281 = r253276 * r253280;
        double r253282 = sqrt(r253281);
        double r253283 = r253275 - r253282;
        return r253283;
}

double f(double x) {
        double r253284 = x;
        double r253285 = -0.0007332210515937477;
        bool r253286 = r253284 <= r253285;
        double r253287 = 0.5;
        double r253288 = -r253287;
        double r253289 = 1.0;
        double r253290 = hypot(r253289, r253284);
        double r253291 = sqrt(r253290);
        double r253292 = r253289 / r253291;
        double r253293 = r253292 / r253291;
        double r253294 = r253289 + r253293;
        double r253295 = r253289 * r253289;
        double r253296 = fma(r253288, r253294, r253295);
        double r253297 = r253289 / r253290;
        double r253298 = r253289 + r253297;
        double r253299 = r253287 * r253298;
        double r253300 = sqrt(r253299);
        double r253301 = r253289 + r253300;
        double r253302 = cbrt(r253301);
        double r253303 = r253302 * r253302;
        double r253304 = sqrt(r253301);
        double r253305 = cbrt(r253304);
        double r253306 = r253305 * r253305;
        double r253307 = r253303 * r253306;
        double r253308 = r253296 / r253307;
        double r253309 = 0.0013551915349228707;
        bool r253310 = r253284 <= r253309;
        double r253311 = 0.25;
        double r253312 = 2.0;
        double r253313 = pow(r253284, r253312);
        double r253314 = sqrt(r253289);
        double r253315 = 3.0;
        double r253316 = pow(r253314, r253315);
        double r253317 = r253313 / r253316;
        double r253318 = 1.0;
        double r253319 = r253318 / r253314;
        double r253320 = 0.1875;
        double r253321 = 4.0;
        double r253322 = pow(r253284, r253321);
        double r253323 = 5.0;
        double r253324 = pow(r253314, r253323);
        double r253325 = r253322 / r253324;
        double r253326 = r253320 * r253325;
        double r253327 = fma(r253287, r253319, r253326);
        double r253328 = r253287 - r253327;
        double r253329 = fma(r253311, r253317, r253328);
        double r253330 = r253329 / r253301;
        double r253331 = 0.3333333333333333;
        double r253332 = pow(r253301, r253331);
        double r253333 = r253303 * r253332;
        double r253334 = r253296 / r253333;
        double r253335 = r253310 ? r253330 : r253334;
        double r253336 = r253286 ? r253308 : r253335;
        return r253336;
}

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if x < -0.0007332210515937477

    1. Initial program 1.1

      \[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
    2. Using strategy rm
    3. Applied flip--1.1

      \[\leadsto \color{blue}{\frac{1 \cdot 1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}\]
    4. Simplified0.1

      \[\leadsto \frac{\color{blue}{\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)}}\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt0.1

      \[\leadsto \frac{\mathsf{fma}\left(-0.5, 1 + \frac{1}{\color{blue}{\sqrt{\mathsf{hypot}\left(1, x\right)} \cdot \sqrt{\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)}}\]
    7. Applied associate-/r*0.1

      \[\leadsto \frac{\mathsf{fma}\left(-0.5, 1 + \color{blue}{\frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\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)}}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt0.1

      \[\leadsto \frac{\mathsf{fma}\left(-0.5, 1 + \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\mathsf{hypot}\left(1, x\right)}}, 1 \cdot 1\right)}{\color{blue}{\left(\sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}} \cdot \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right) \cdot \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}}\]
    10. Using strategy rm
    11. Applied add-sqr-sqrt0.1

      \[\leadsto \frac{\mathsf{fma}\left(-0.5, 1 + \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\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 \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right) \cdot \sqrt[3]{\color{blue}{\sqrt{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}} \cdot \sqrt{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}}}\]
    12. Applied cbrt-prod0.1

      \[\leadsto \frac{\mathsf{fma}\left(-0.5, 1 + \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\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 \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right) \cdot \color{blue}{\left(\sqrt[3]{\sqrt{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}} \cdot \sqrt[3]{\sqrt{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}\right)}}\]

    if -0.0007332210515937477 < x < 0.0013551915349228707

    1. Initial program 31.0

      \[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
    2. Using strategy rm
    3. Applied flip--31.0

      \[\leadsto \color{blue}{\frac{1 \cdot 1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}\]
    4. Simplified31.0

      \[\leadsto \frac{\color{blue}{\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)}}\]
    5. Taylor expanded around 0 31.0

      \[\leadsto \frac{\color{blue}{\left(0.25 \cdot \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{3}} + 0.5\right) - \left(0.5 \cdot \frac{1}{\sqrt{1}} + 0.1875 \cdot \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{5}}\right)}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\]
    6. Simplified0.2

      \[\leadsto \frac{\color{blue}{\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)}}\]

    if 0.0013551915349228707 < x

    1. Initial program 1.1

      \[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
    2. Using strategy rm
    3. Applied flip--1.1

      \[\leadsto \color{blue}{\frac{1 \cdot 1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}\]
    4. Simplified0.1

      \[\leadsto \frac{\color{blue}{\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)}}\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt0.1

      \[\leadsto \frac{\mathsf{fma}\left(-0.5, 1 + \frac{1}{\color{blue}{\sqrt{\mathsf{hypot}\left(1, x\right)} \cdot \sqrt{\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)}}\]
    7. Applied associate-/r*0.1

      \[\leadsto \frac{\mathsf{fma}\left(-0.5, 1 + \color{blue}{\frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\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)}}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt0.2

      \[\leadsto \frac{\mathsf{fma}\left(-0.5, 1 + \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\mathsf{hypot}\left(1, x\right)}}, 1 \cdot 1\right)}{\color{blue}{\left(\sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}} \cdot \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right) \cdot \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}}\]
    10. Using strategy rm
    11. Applied pow1/30.2

      \[\leadsto \frac{\mathsf{fma}\left(-0.5, 1 + \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\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 \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right) \cdot \color{blue}{{\left(1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{\frac{1}{3}}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -7.332210515937476582107312772507157205837 \cdot 10^{-4}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.5, 1 + \frac{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\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 \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right) \cdot \left(\sqrt[3]{\sqrt{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}} \cdot \sqrt[3]{\sqrt{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}}\right)}\\ \mathbf{elif}\;x \le 0.001355191534922870703200326047976886911783:\\ \;\;\;\;\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{\frac{1}{\sqrt{\mathsf{hypot}\left(1, x\right)}}}{\sqrt{\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 \sqrt[3]{1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}}\right) \cdot {\left(1 + \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)}^{\frac{1}{3}}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019356 +o rules:numerics
(FPCore (x)
  :name "Given's Rotation SVD example, simplified"
  :precision binary64
  (- 1 (sqrt (* 0.5 (+ 1 (/ 1 (hypot 1 x)))))))