Average Error: 15.7 → 0.2
Time: 19.4s
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 -0.00287753907949529894:\\ \;\;\;\;\frac{{1}^{3}}{\mathsf{fma}\left(1, 1, \mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)\right)} - \frac{{\left(0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)}^{\frac{3}{2}}}{\mathsf{fma}\left(1, 1, \mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)\right)}\\ \mathbf{elif}\;x \le 0.00142444280501321705:\\ \;\;\;\;\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{\left({1}^{\frac{3}{2}} + {\left(0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)}^{\frac{3}{4}}\right) \cdot \left({1}^{\frac{3}{2}} - {\left(0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)}^{\frac{3}{4}}\right)}{\mathsf{fma}\left(1, 1, \mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)\right)}\\ \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 -0.00287753907949529894:\\
\;\;\;\;\frac{{1}^{3}}{\mathsf{fma}\left(1, 1, \mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)\right)} - \frac{{\left(0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)}^{\frac{3}{2}}}{\mathsf{fma}\left(1, 1, \mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)\right)}\\

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

\end{array}
double code(double x) {
	return (1.0 - sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x))))));
}
double code(double x) {
	double VAR;
	if ((x <= -0.002877539079495299)) {
		VAR = ((pow(1.0, 3.0) / fma(1.0, 1.0, fma(0.5, (1.0 + (1.0 / hypot(1.0, x))), (1.0 * sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x))))))))) - (pow((0.5 * (1.0 + (1.0 / hypot(1.0, x)))), 1.5) / fma(1.0, 1.0, fma(0.5, (1.0 + (1.0 / hypot(1.0, x))), (1.0 * sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x))))))))));
	} else {
		double VAR_1;
		if ((x <= 0.001424442805013217)) {
			VAR_1 = (fma(0.25, (pow(x, 2.0) / pow(sqrt(1.0), 3.0)), (0.5 - fma(0.5, (1.0 / sqrt(1.0)), (0.1875 * (pow(x, 4.0) / pow(sqrt(1.0), 5.0)))))) / (1.0 + sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x)))))));
		} else {
			VAR_1 = (((pow(1.0, 1.5) + pow((0.5 * (1.0 + (1.0 / hypot(1.0, x)))), 0.75)) * (pow(1.0, 1.5) - pow((0.5 * (1.0 + (1.0 / hypot(1.0, x)))), 0.75))) / fma(1.0, 1.0, fma(0.5, (1.0 + (1.0 / hypot(1.0, x))), (1.0 * sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x)))))))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

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

    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 flip3--1.6

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

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

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

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

      \[\leadsto \frac{{1}^{3} - {\left(0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)}^{\color{blue}{\frac{3}{2}}}}{\mathsf{fma}\left(1, 1, \mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)\right)}\]
    9. Using strategy rm
    10. Applied div-sub0.1

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

    if -0.002877539079495299 < x < 0.001424442805013217

    1. Initial program 30.4

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

      \[\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. Simplified30.4

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

      \[\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.3

      \[\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.001424442805013217 < x

    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 flip3--1.6

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{{1}^{\left(\frac{3}{2}\right)} \cdot {1}^{\left(\frac{3}{2}\right)}} - {\left(0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)}^{\left(\frac{\frac{3}{2}}{2}\right)} \cdot {\left(0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)\right)}^{\left(\frac{\frac{3}{2}}{2}\right)}}{\mathsf{fma}\left(1, 1, \mathsf{fma}\left(0.5, 1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}, 1 \cdot \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\right)\right)}\]
    12. Applied difference-of-squares0.1

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

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

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

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

Reproduce

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