?

Average Accuracy: 76.2% → 99.7%
Time: 16.3s
Precision: binary64
Cost: 100616

?

\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} \]
\[\begin{array}{l} t_0 := \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\ t_1 := 0.5 + t_0\\ t_2 := \sqrt{t_1}\\ t_3 := 0.5 + \left(t_0 + t_2\right)\\ \mathbf{if}\;x \leq -1.2:\\ \;\;\;\;\frac{1 + \left(-0.5 + \frac{0.5}{x}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 0.012:\\ \;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - {t_1}^{1.5}}{\frac{1 + {t_3}^{3}}{0.5 + \left(t_3 \cdot t_3 + \left(\frac{-0.5}{\mathsf{hypot}\left(1, x\right)} - t_2\right)\right)}}\\ \end{array} \]
(FPCore (x)
 :precision binary64
 (- 1.0 (sqrt (* 0.5 (+ 1.0 (/ 1.0 (hypot 1.0 x)))))))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (/ 0.5 (hypot 1.0 x)))
        (t_1 (+ 0.5 t_0))
        (t_2 (sqrt t_1))
        (t_3 (+ 0.5 (+ t_0 t_2))))
   (if (<= x -1.2)
     (/ (+ 1.0 (+ -0.5 (/ 0.5 x))) (+ 1.0 (sqrt (+ 0.5 (/ -0.5 x)))))
     (if (<= x 0.012)
       (+
        (* 0.125 (pow x 2.0))
        (+ (* 0.0673828125 (pow x 6.0)) (* -0.0859375 (pow x 4.0))))
       (/
        (- 1.0 (pow t_1 1.5))
        (/
         (+ 1.0 (pow t_3 3.0))
         (+ 0.5 (+ (* t_3 t_3) (- (/ -0.5 (hypot 1.0 x)) t_2)))))))))
double code(double x) {
	return 1.0 - sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x)))));
}
double code(double x) {
	double t_0 = 0.5 / hypot(1.0, x);
	double t_1 = 0.5 + t_0;
	double t_2 = sqrt(t_1);
	double t_3 = 0.5 + (t_0 + t_2);
	double tmp;
	if (x <= -1.2) {
		tmp = (1.0 + (-0.5 + (0.5 / x))) / (1.0 + sqrt((0.5 + (-0.5 / x))));
	} else if (x <= 0.012) {
		tmp = (0.125 * pow(x, 2.0)) + ((0.0673828125 * pow(x, 6.0)) + (-0.0859375 * pow(x, 4.0)));
	} else {
		tmp = (1.0 - pow(t_1, 1.5)) / ((1.0 + pow(t_3, 3.0)) / (0.5 + ((t_3 * t_3) + ((-0.5 / hypot(1.0, x)) - t_2))));
	}
	return tmp;
}
public static double code(double x) {
	return 1.0 - Math.sqrt((0.5 * (1.0 + (1.0 / Math.hypot(1.0, x)))));
}
public static double code(double x) {
	double t_0 = 0.5 / Math.hypot(1.0, x);
	double t_1 = 0.5 + t_0;
	double t_2 = Math.sqrt(t_1);
	double t_3 = 0.5 + (t_0 + t_2);
	double tmp;
	if (x <= -1.2) {
		tmp = (1.0 + (-0.5 + (0.5 / x))) / (1.0 + Math.sqrt((0.5 + (-0.5 / x))));
	} else if (x <= 0.012) {
		tmp = (0.125 * Math.pow(x, 2.0)) + ((0.0673828125 * Math.pow(x, 6.0)) + (-0.0859375 * Math.pow(x, 4.0)));
	} else {
		tmp = (1.0 - Math.pow(t_1, 1.5)) / ((1.0 + Math.pow(t_3, 3.0)) / (0.5 + ((t_3 * t_3) + ((-0.5 / Math.hypot(1.0, x)) - t_2))));
	}
	return tmp;
}
def code(x):
	return 1.0 - math.sqrt((0.5 * (1.0 + (1.0 / math.hypot(1.0, x)))))
def code(x):
	t_0 = 0.5 / math.hypot(1.0, x)
	t_1 = 0.5 + t_0
	t_2 = math.sqrt(t_1)
	t_3 = 0.5 + (t_0 + t_2)
	tmp = 0
	if x <= -1.2:
		tmp = (1.0 + (-0.5 + (0.5 / x))) / (1.0 + math.sqrt((0.5 + (-0.5 / x))))
	elif x <= 0.012:
		tmp = (0.125 * math.pow(x, 2.0)) + ((0.0673828125 * math.pow(x, 6.0)) + (-0.0859375 * math.pow(x, 4.0)))
	else:
		tmp = (1.0 - math.pow(t_1, 1.5)) / ((1.0 + math.pow(t_3, 3.0)) / (0.5 + ((t_3 * t_3) + ((-0.5 / math.hypot(1.0, x)) - t_2))))
	return tmp
function code(x)
	return Float64(1.0 - sqrt(Float64(0.5 * Float64(1.0 + Float64(1.0 / hypot(1.0, x))))))
end
function code(x)
	t_0 = Float64(0.5 / hypot(1.0, x))
	t_1 = Float64(0.5 + t_0)
	t_2 = sqrt(t_1)
	t_3 = Float64(0.5 + Float64(t_0 + t_2))
	tmp = 0.0
	if (x <= -1.2)
		tmp = Float64(Float64(1.0 + Float64(-0.5 + Float64(0.5 / x))) / Float64(1.0 + sqrt(Float64(0.5 + Float64(-0.5 / x)))));
	elseif (x <= 0.012)
		tmp = Float64(Float64(0.125 * (x ^ 2.0)) + Float64(Float64(0.0673828125 * (x ^ 6.0)) + Float64(-0.0859375 * (x ^ 4.0))));
	else
		tmp = Float64(Float64(1.0 - (t_1 ^ 1.5)) / Float64(Float64(1.0 + (t_3 ^ 3.0)) / Float64(0.5 + Float64(Float64(t_3 * t_3) + Float64(Float64(-0.5 / hypot(1.0, x)) - t_2)))));
	end
	return tmp
end
function tmp = code(x)
	tmp = 1.0 - sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x)))));
end
function tmp_2 = code(x)
	t_0 = 0.5 / hypot(1.0, x);
	t_1 = 0.5 + t_0;
	t_2 = sqrt(t_1);
	t_3 = 0.5 + (t_0 + t_2);
	tmp = 0.0;
	if (x <= -1.2)
		tmp = (1.0 + (-0.5 + (0.5 / x))) / (1.0 + sqrt((0.5 + (-0.5 / x))));
	elseif (x <= 0.012)
		tmp = (0.125 * (x ^ 2.0)) + ((0.0673828125 * (x ^ 6.0)) + (-0.0859375 * (x ^ 4.0)));
	else
		tmp = (1.0 - (t_1 ^ 1.5)) / ((1.0 + (t_3 ^ 3.0)) / (0.5 + ((t_3 * t_3) + ((-0.5 / hypot(1.0, x)) - t_2))));
	end
	tmp_2 = tmp;
end
code[x_] := N[(1.0 - N[Sqrt[N[(0.5 * N[(1.0 + N[(1.0 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_] := Block[{t$95$0 = N[(0.5 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[(0.5 + N[(t$95$0 + t$95$2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.2], N[(N[(1.0 + N[(-0.5 + N[(0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[Sqrt[N[(0.5 + N[(-0.5 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.012], N[(N[(0.125 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.0673828125 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] + N[(-0.0859375 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[Power[t$95$1, 1.5], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[Power[t$95$3, 3.0], $MachinePrecision]), $MachinePrecision] / N[(0.5 + N[(N[(t$95$3 * t$95$3), $MachinePrecision] + N[(N[(-0.5 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\begin{array}{l}
t_0 := \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\
t_1 := 0.5 + t_0\\
t_2 := \sqrt{t_1}\\
t_3 := 0.5 + \left(t_0 + t_2\right)\\
\mathbf{if}\;x \leq -1.2:\\
\;\;\;\;\frac{1 + \left(-0.5 + \frac{0.5}{x}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\

\mathbf{elif}\;x \leq 0.012:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - {t_1}^{1.5}}{\frac{1 + {t_3}^{3}}{0.5 + \left(t_3 \cdot t_3 + \left(\frac{-0.5}{\mathsf{hypot}\left(1, x\right)} - t_2\right)\right)}}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

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

    1. Initial program 98.5%

      \[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} \]
    2. Simplified98.5%

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

      [Start]98.5

      \[ 1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} \]

      distribute-lft-in [=>]98.5

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

      metadata-eval [=>]98.5

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

      associate-*r/ [=>]98.5

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

      metadata-eval [=>]98.5

      \[ 1 - \sqrt{0.5 + \frac{\color{blue}{0.5}}{\mathsf{hypot}\left(1, x\right)}} \]
    3. Taylor expanded in x around -inf 97.7%

      \[\leadsto 1 - \sqrt{\color{blue}{0.5 - 0.5 \cdot \frac{1}{x}}} \]
    4. Simplified97.7%

      \[\leadsto 1 - \sqrt{\color{blue}{0.5 - \frac{0.5}{x}}} \]
      Proof

      [Start]97.7

      \[ 1 - \sqrt{0.5 - 0.5 \cdot \frac{1}{x}} \]

      associate-*r/ [=>]97.7

      \[ 1 - \sqrt{0.5 - \color{blue}{\frac{0.5 \cdot 1}{x}}} \]

      metadata-eval [=>]97.7

      \[ 1 - \sqrt{0.5 - \frac{\color{blue}{0.5}}{x}} \]
    5. Applied egg-rr97.7%

      \[\leadsto \color{blue}{\frac{1 - \left(-\sqrt{0.5 + \frac{-0.5}{x}}\right) \cdot \left(-\sqrt{0.5 + \frac{-0.5}{x}}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}} \]
      Proof

      [Start]97.7

      \[ 1 - \sqrt{0.5 - \frac{0.5}{x}} \]

      sub-neg [=>]97.7

      \[ \color{blue}{1 + \left(-\sqrt{0.5 - \frac{0.5}{x}}\right)} \]

      flip-+ [=>]97.7

      \[ \color{blue}{\frac{1 \cdot 1 - \left(-\sqrt{0.5 - \frac{0.5}{x}}\right) \cdot \left(-\sqrt{0.5 - \frac{0.5}{x}}\right)}{1 - \left(-\sqrt{0.5 - \frac{0.5}{x}}\right)}} \]
    6. Simplified99.1%

      \[\leadsto \color{blue}{\frac{1 - \left(0.5 + \frac{-0.5}{x}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}} \]
      Proof

      [Start]97.7

      \[ \frac{1 - \left(-\sqrt{0.5 + \frac{-0.5}{x}}\right) \cdot \left(-\sqrt{0.5 + \frac{-0.5}{x}}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}} \]

      sqr-neg [=>]97.7

      \[ \frac{1 - \color{blue}{\sqrt{0.5 + \frac{-0.5}{x}} \cdot \sqrt{0.5 + \frac{-0.5}{x}}}}{1 + \sqrt{0.5 + \frac{-0.5}{x}}} \]

      rem-square-sqrt [=>]99.1

      \[ \frac{1 - \color{blue}{\left(0.5 + \frac{-0.5}{x}\right)}}{1 + \sqrt{0.5 + \frac{-0.5}{x}}} \]

    if -1.19999999999999996 < x < 0.012

    1. Initial program 53.8%

      \[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} \]
    2. Simplified53.8%

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

      [Start]53.8

      \[ 1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} \]

      distribute-lft-in [=>]53.8

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

      metadata-eval [=>]53.8

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

      associate-*r/ [=>]53.8

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

      metadata-eval [=>]53.8

      \[ 1 - \sqrt{0.5 + \frac{\color{blue}{0.5}}{\mathsf{hypot}\left(1, x\right)}} \]
    3. Taylor expanded in x around 0 99.8%

      \[\leadsto \color{blue}{0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)} \]

    if 0.012 < x

    1. Initial program 98.4%

      \[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} \]
    2. Simplified98.4%

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

      [Start]98.4

      \[ 1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} \]

      distribute-lft-in [=>]98.4

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

      metadata-eval [=>]98.4

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

      associate-*r/ [=>]98.4

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

      metadata-eval [=>]98.4

      \[ 1 - \sqrt{0.5 + \frac{\color{blue}{0.5}}{\mathsf{hypot}\left(1, x\right)}} \]
    3. Applied egg-rr99.9%

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

      [Start]98.4

      \[ 1 - \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}} \]

      flip3-- [=>]97.5

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

      metadata-eval [=>]97.5

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

      flip3-+ [=>]97.5

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

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

      [Start]99.9

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

      associate-*l/ [=>]99.9

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

      associate-/l* [=>]99.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.2:\\ \;\;\;\;\frac{1 + \left(-0.5 + \frac{0.5}{x}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 0.012:\\ \;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - {\left(0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\right)}^{1.5}}{\frac{1 + {\left(0.5 + \left(\frac{0.5}{\mathsf{hypot}\left(1, x\right)} + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)\right)}^{3}}{0.5 + \left(\left(0.5 + \left(\frac{0.5}{\mathsf{hypot}\left(1, x\right)} + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)\right) \cdot \left(0.5 + \left(\frac{0.5}{\mathsf{hypot}\left(1, x\right)} + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)\right) + \left(\frac{-0.5}{\mathsf{hypot}\left(1, x\right)} - \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)\right)}}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy99.7%
Cost33736
\[\begin{array}{l} t_0 := \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\ t_1 := 0.5 + t_0\\ \mathbf{if}\;x \leq -1.2:\\ \;\;\;\;\frac{1 + \left(-0.5 + \frac{0.5}{x}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 0.012:\\ \;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - {t_1}^{1.5}}{t_0 + \left(1.5 + \sqrt{t_1}\right)}\\ \end{array} \]
Alternative 2
Accuracy99.9%
Cost27396
\[\begin{array}{l} t_0 := 0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\ \mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.01:\\ \;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25 + \frac{-0.25}{1 + x \cdot x}}{t_0 \cdot \left(1 + \sqrt{t_0}\right)}\\ \end{array} \]
Alternative 3
Accuracy99.9%
Cost26884
\[\begin{array}{l} \mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.01:\\ \;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + \left(-0.5 + \frac{-0.5}{\mathsf{hypot}\left(1, x\right)}\right)}{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}\\ \end{array} \]
Alternative 4
Accuracy99.7%
Cost22472
\[\begin{array}{l} t_0 := 1 + x \cdot x\\ t_1 := \frac{0.25}{t_0}\\ t_2 := 0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\ \mathbf{if}\;x \leq -1.2:\\ \;\;\;\;\frac{1 + \left(-0.5 + \frac{0.5}{x}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 0.007:\\ \;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{1}{\frac{0.0625 + t_1 \cdot \frac{-0.25}{t_0}}{t_2 \cdot \left(0.25 + t_1\right)}}}}{1 + \sqrt{t_2}}\\ \end{array} \]
Alternative 5
Accuracy99.7%
Cost21192
\[\begin{array}{l} t_0 := 0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\ \mathbf{if}\;x \leq -1.2:\\ \;\;\;\;\frac{1 + \left(-0.5 + \frac{0.5}{x}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 0.01:\\ \;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{t_0}{0.25 + \frac{-0.25}{1 + x \cdot x}}}}{1 + \sqrt{t_0}}\\ \end{array} \]
Alternative 6
Accuracy99.7%
Cost20424
\[\begin{array}{l} \mathbf{if}\;x \leq -1.2:\\ \;\;\;\;\frac{1 + \left(-0.5 + \frac{0.5}{x}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 0.0092:\\ \;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 + \frac{-0.5}{\mathsf{hypot}\left(1, x\right)}}{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}\\ \end{array} \]
Alternative 7
Accuracy99.4%
Cost20360
\[\begin{array}{l} \mathbf{if}\;x \leq -1.2:\\ \;\;\;\;\frac{1 + \left(-0.5 + \frac{0.5}{x}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 1.2:\\ \;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + \left(-0.5 + \frac{-0.5}{x}\right)}{1 + \sqrt{0.5 - \frac{-0.5}{x}}}\\ \end{array} \]
Alternative 8
Accuracy99.3%
Cost7624
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{1 + \left(-0.5 + \frac{0.5}{x}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 1.1:\\ \;\;\;\;-0.0859375 \cdot {x}^{4} + x \cdot \left(x \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + \left(-0.5 + \frac{-0.5}{x}\right)}{1 + \sqrt{0.5 - \frac{-0.5}{x}}}\\ \end{array} \]
Alternative 9
Accuracy99.0%
Cost7492
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{1 + \left(-0.5 + \frac{0.5}{x}\right)}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 1.1:\\ \;\;\;\;-0.0859375 \cdot {x}^{4} + x \cdot \left(x \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \sqrt{0.5 - \frac{-0.5}{x}}\\ \end{array} \]
Alternative 10
Accuracy98.5%
Cost7304
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\ \mathbf{elif}\;x \leq 1.1:\\ \;\;\;\;-0.0859375 \cdot {x}^{4} + x \cdot \left(x \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \sqrt{0.5 - \frac{-0.5}{x}}\\ \end{array} \]
Alternative 11
Accuracy98.3%
Cost7112
\[\begin{array}{l} \mathbf{if}\;x \leq -1.52:\\ \;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\ \mathbf{elif}\;x \leq 1.25:\\ \;\;\;\;0.125 \cdot \left(x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \sqrt{0.5 - \frac{-0.5}{x}}\\ \end{array} \]
Alternative 12
Accuracy98.4%
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -1.52 \lor \neg \left(x \leq 1.52\right):\\ \;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\ \mathbf{else}:\\ \;\;\;\;0.125 \cdot \left(x \cdot x\right)\\ \end{array} \]
Alternative 13
Accuracy97.7%
Cost6857
\[\begin{array}{l} \mathbf{if}\;x \leq -1.52 \lor \neg \left(x \leq 1.52\right):\\ \;\;\;\;1 - \sqrt{0.5}\\ \mathbf{else}:\\ \;\;\;\;0.125 \cdot \left(x \cdot x\right)\\ \end{array} \]
Alternative 14
Accuracy58.7%
Cost969
\[\begin{array}{l} \mathbf{if}\;x \leq -8.2 \cdot 10^{-5} \lor \neg \left(x \leq 8.2 \cdot 10^{-5}\right):\\ \;\;\;\;\frac{0.25 + \frac{-0.25}{1 + x \cdot x}}{2}\\ \mathbf{else}:\\ \;\;\;\;0.125 \cdot \left(x \cdot x\right)\\ \end{array} \]
Alternative 15
Accuracy58.7%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;0.125\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;0.125 \cdot \left(x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;0.125\\ \end{array} \]
Alternative 16
Accuracy35.9%
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -1.75 \cdot 10^{-77}:\\ \;\;\;\;0.125\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{-77}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;0.125\\ \end{array} \]
Alternative 17
Accuracy27.9%
Cost64
\[0 \]

Error

Reproduce?

herbie shell --seed 2023140 
(FPCore (x)
  :name "Given's Rotation SVD example, simplified"
  :precision binary64
  (- 1.0 (sqrt (* 0.5 (+ 1.0 (/ 1.0 (hypot 1.0 x)))))))