Average Error: 15.3 → 13.3
Time: 58.0s
Precision: 64
\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{\mathsf{hypot}\left(1, x\right)} \le 0.040952578771010065:\\ \;\;\;\;\frac{{\left(1 \cdot 1\right)}^{3} - {\left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right)}^{3}}{\mathsf{fma}\left(1, {1}^{3}, \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \mathsf{fma}\left(1, 1, 0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)\right) \cdot \left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(0.1875, \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{5}}, \mathsf{fma}\left(0.375, \frac{{x}^{2}}{1 \cdot 1}, \mathsf{fma}\left(0.1875, \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{3}}, 0.875\right)\right) - \mathsf{fma}\left(0.375, \frac{1}{\sqrt{1}}, \mathsf{fma}\left(\frac{1}{1}, 0.375, \mathsf{fma}\left(0.140625, \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{5}}, \mathsf{fma}\left(0.234375, \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{7}}, \mathsf{fma}\left(0.375, \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{6}}, 0.125 \cdot \frac{1}{{\left(\sqrt{1}\right)}^{3}}\right)\right)\right)\right)\right)\right)}{\mathsf{fma}\left(1, {1}^{3}, \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \mathsf{fma}\left(1, 1, 0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)\right) \cdot \left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1\right)}\\ \end{array}\]
1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\begin{array}{l}
\mathbf{if}\;\frac{1}{\mathsf{hypot}\left(1, x\right)} \le 0.040952578771010065:\\
\;\;\;\;\frac{{\left(1 \cdot 1\right)}^{3} - {\left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right)}^{3}}{\mathsf{fma}\left(1, {1}^{3}, \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \mathsf{fma}\left(1, 1, 0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)\right) \cdot \left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.1875, \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{5}}, \mathsf{fma}\left(0.375, \frac{{x}^{2}}{1 \cdot 1}, \mathsf{fma}\left(0.1875, \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{3}}, 0.875\right)\right) - \mathsf{fma}\left(0.375, \frac{1}{\sqrt{1}}, \mathsf{fma}\left(\frac{1}{1}, 0.375, \mathsf{fma}\left(0.140625, \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{5}}, \mathsf{fma}\left(0.234375, \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{7}}, \mathsf{fma}\left(0.375, \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{6}}, 0.125 \cdot \frac{1}{{\left(\sqrt{1}\right)}^{3}}\right)\right)\right)\right)\right)\right)}{\mathsf{fma}\left(1, {1}^{3}, \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \mathsf{fma}\left(1, 1, 0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)\right) \cdot \left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1\right)}\\

\end{array}
double f(double x) {
        double r290170 = 1.0;
        double r290171 = 0.5;
        double r290172 = x;
        double r290173 = hypot(r290170, r290172);
        double r290174 = r290170 / r290173;
        double r290175 = r290170 + r290174;
        double r290176 = r290171 * r290175;
        double r290177 = sqrt(r290176);
        double r290178 = r290170 - r290177;
        return r290178;
}

double f(double x) {
        double r290179 = 1.0;
        double r290180 = x;
        double r290181 = hypot(r290179, r290180);
        double r290182 = r290179 / r290181;
        double r290183 = 0.040952578771010065;
        bool r290184 = r290182 <= r290183;
        double r290185 = r290179 * r290179;
        double r290186 = 3.0;
        double r290187 = pow(r290185, r290186);
        double r290188 = r290179 + r290182;
        double r290189 = 0.5;
        double r290190 = r290188 * r290189;
        double r290191 = pow(r290190, r290186);
        double r290192 = r290187 - r290191;
        double r290193 = pow(r290179, r290186);
        double r290194 = r290189 * r290188;
        double r290195 = fma(r290179, r290179, r290194);
        double r290196 = r290190 * r290195;
        double r290197 = fma(r290179, r290193, r290196);
        double r290198 = sqrt(r290194);
        double r290199 = r290198 + r290179;
        double r290200 = r290197 * r290199;
        double r290201 = r290192 / r290200;
        double r290202 = 0.1875;
        double r290203 = 2.0;
        double r290204 = pow(r290180, r290203);
        double r290205 = sqrt(r290179);
        double r290206 = 5.0;
        double r290207 = pow(r290205, r290206);
        double r290208 = r290204 / r290207;
        double r290209 = 0.375;
        double r290210 = r290204 / r290185;
        double r290211 = pow(r290205, r290186);
        double r290212 = r290204 / r290211;
        double r290213 = 0.875;
        double r290214 = fma(r290202, r290212, r290213);
        double r290215 = fma(r290209, r290210, r290214);
        double r290216 = 1.0;
        double r290217 = r290216 / r290205;
        double r290218 = r290216 / r290179;
        double r290219 = 0.140625;
        double r290220 = 4.0;
        double r290221 = pow(r290180, r290220);
        double r290222 = r290221 / r290207;
        double r290223 = 0.234375;
        double r290224 = 7.0;
        double r290225 = pow(r290205, r290224);
        double r290226 = r290221 / r290225;
        double r290227 = 6.0;
        double r290228 = pow(r290205, r290227);
        double r290229 = r290221 / r290228;
        double r290230 = 0.125;
        double r290231 = r290216 / r290211;
        double r290232 = r290230 * r290231;
        double r290233 = fma(r290209, r290229, r290232);
        double r290234 = fma(r290223, r290226, r290233);
        double r290235 = fma(r290219, r290222, r290234);
        double r290236 = fma(r290218, r290209, r290235);
        double r290237 = fma(r290209, r290217, r290236);
        double r290238 = r290215 - r290237;
        double r290239 = fma(r290202, r290208, r290238);
        double r290240 = r290239 / r290200;
        double r290241 = r290184 ? r290201 : r290240;
        return r290241;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if (/ 1.0 (hypot 1.0 x)) < 0.040952578771010065

    1. Initial program 1.0

      \[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\]
    2. Using strategy rm
    3. Applied flip--1.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. Simplified0.0

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

      \[\leadsto \frac{1 \cdot 1 - \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5}{\color{blue}{\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1}}\]
    6. Using strategy rm
    7. Applied flip3--0.0

      \[\leadsto \frac{\color{blue}{\frac{{\left(1 \cdot 1\right)}^{3} - {\left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right)}^{3}}{\left(1 \cdot 1\right) \cdot \left(1 \cdot 1\right) + \left(\left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) + \left(1 \cdot 1\right) \cdot \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right)\right)}}}{\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1}\]
    8. Applied associate-/l/0.0

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

      \[\leadsto \frac{{\left(1 \cdot 1\right)}^{3} - {\left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right)}^{3}}{\color{blue}{\mathsf{fma}\left(1, {1}^{3}, \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \mathsf{fma}\left(1, 1, 0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)\right) \cdot \left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1\right)}}\]

    if 0.040952578771010065 < (/ 1.0 (hypot 1.0 x))

    1. Initial program 29.6

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

      \[\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. Simplified29.6

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

      \[\leadsto \frac{1 \cdot 1 - \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5}{\color{blue}{\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1}}\]
    6. Using strategy rm
    7. Applied flip3--29.6

      \[\leadsto \frac{\color{blue}{\frac{{\left(1 \cdot 1\right)}^{3} - {\left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right)}^{3}}{\left(1 \cdot 1\right) \cdot \left(1 \cdot 1\right) + \left(\left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) + \left(1 \cdot 1\right) \cdot \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right)\right)}}}{\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1}\]
    8. Applied associate-/l/29.6

      \[\leadsto \color{blue}{\frac{{\left(1 \cdot 1\right)}^{3} - {\left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right)}^{3}}{\left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1\right) \cdot \left(\left(1 \cdot 1\right) \cdot \left(1 \cdot 1\right) + \left(\left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) + \left(1 \cdot 1\right) \cdot \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right)\right)\right)}}\]
    9. Simplified29.6

      \[\leadsto \frac{{\left(1 \cdot 1\right)}^{3} - {\left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right)}^{3}}{\color{blue}{\mathsf{fma}\left(1, {1}^{3}, \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \mathsf{fma}\left(1, 1, 0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)\right) \cdot \left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1\right)}}\]
    10. Taylor expanded around 0 30.1

      \[\leadsto \frac{\color{blue}{\left(0.1875 \cdot \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{5}} + \left(0.375 \cdot \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{4}} + \left(0.1875 \cdot \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{3}} + 0.875\right)\right)\right) - \left(0.375 \cdot \frac{1}{\sqrt{1}} + \left(0.375 \cdot \frac{1}{{\left(\sqrt{1}\right)}^{2}} + \left(0.140625 \cdot \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{5}} + \left(0.234375 \cdot \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{7}} + \left(0.375 \cdot \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{6}} + 0.125 \cdot \frac{1}{{\left(\sqrt{1}\right)}^{3}}\right)\right)\right)\right)\right)}}{\mathsf{fma}\left(1, {1}^{3}, \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \mathsf{fma}\left(1, 1, 0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)\right) \cdot \left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1\right)}\]
    11. Simplified26.5

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(0.1875, \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{5}}, \mathsf{fma}\left(0.375, \frac{{x}^{2}}{1 \cdot 1}, \mathsf{fma}\left(0.1875, \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{3}}, 0.875\right)\right) - \mathsf{fma}\left(0.375, \frac{1}{\sqrt{1}}, \mathsf{fma}\left(\frac{1}{1}, 0.375, \mathsf{fma}\left(0.140625, \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{5}}, \mathsf{fma}\left(0.234375, \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{7}}, \mathsf{fma}\left(0.375, \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{6}}, 0.125 \cdot \frac{1}{{\left(\sqrt{1}\right)}^{3}}\right)\right)\right)\right)\right)\right)}}{\mathsf{fma}\left(1, {1}^{3}, \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \mathsf{fma}\left(1, 1, 0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)\right) \cdot \left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification13.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{\mathsf{hypot}\left(1, x\right)} \le 0.040952578771010065:\\ \;\;\;\;\frac{{\left(1 \cdot 1\right)}^{3} - {\left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right)}^{3}}{\mathsf{fma}\left(1, {1}^{3}, \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \mathsf{fma}\left(1, 1, 0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)\right) \cdot \left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(0.1875, \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{5}}, \mathsf{fma}\left(0.375, \frac{{x}^{2}}{1 \cdot 1}, \mathsf{fma}\left(0.1875, \frac{{x}^{2}}{{\left(\sqrt{1}\right)}^{3}}, 0.875\right)\right) - \mathsf{fma}\left(0.375, \frac{1}{\sqrt{1}}, \mathsf{fma}\left(\frac{1}{1}, 0.375, \mathsf{fma}\left(0.140625, \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{5}}, \mathsf{fma}\left(0.234375, \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{7}}, \mathsf{fma}\left(0.375, \frac{{x}^{4}}{{\left(\sqrt{1}\right)}^{6}}, 0.125 \cdot \frac{1}{{\left(\sqrt{1}\right)}^{3}}\right)\right)\right)\right)\right)\right)}{\mathsf{fma}\left(1, {1}^{3}, \left(\left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right) \cdot 0.5\right) \cdot \mathsf{fma}\left(1, 1, 0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)\right) \cdot \left(\sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} + 1\right)}\\ \end{array}\]

Reproduce

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