?

Average Error: 15.2 → 0.1
Time: 11.8s
Precision: binary64
Cost: 21956

?

\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)} \]
\[\begin{array}{l} t_0 := 0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\ t_1 := 1 + \sqrt{t_0}\\ t_2 := x \cdot x + 1\\ \mathbf{if}\;x \leq -0.002:\\ \;\;\;\;\frac{\frac{0.0625 + \frac{-0.0625}{t_2 \cdot t_2}}{t_0 \cdot \left(0.25 + \frac{0.25}{t_2}\right)}}{t_1}\\ \mathbf{elif}\;x \leq 0.0027:\\ \;\;\;\;{x}^{4} \cdot -0.0859375 + x \cdot \left(x \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_1} \cdot \left(0.5 + \frac{-0.5}{\mathsf{hypot}\left(1, x\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 (/ 0.5 (hypot 1.0 x))))
        (t_1 (+ 1.0 (sqrt t_0)))
        (t_2 (+ (* x x) 1.0)))
   (if (<= x -0.002)
     (/
      (/ (+ 0.0625 (/ -0.0625 (* t_2 t_2))) (* t_0 (+ 0.25 (/ 0.25 t_2))))
      t_1)
     (if (<= x 0.0027)
       (+ (* (pow x 4.0) -0.0859375) (* x (* x 0.125)))
       (* (/ 1.0 t_1) (+ 0.5 (/ -0.5 (hypot 1.0 x))))))))
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 + (0.5 / hypot(1.0, x));
	double t_1 = 1.0 + sqrt(t_0);
	double t_2 = (x * x) + 1.0;
	double tmp;
	if (x <= -0.002) {
		tmp = ((0.0625 + (-0.0625 / (t_2 * t_2))) / (t_0 * (0.25 + (0.25 / t_2)))) / t_1;
	} else if (x <= 0.0027) {
		tmp = (pow(x, 4.0) * -0.0859375) + (x * (x * 0.125));
	} else {
		tmp = (1.0 / t_1) * (0.5 + (-0.5 / hypot(1.0, x)));
	}
	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 + (0.5 / Math.hypot(1.0, x));
	double t_1 = 1.0 + Math.sqrt(t_0);
	double t_2 = (x * x) + 1.0;
	double tmp;
	if (x <= -0.002) {
		tmp = ((0.0625 + (-0.0625 / (t_2 * t_2))) / (t_0 * (0.25 + (0.25 / t_2)))) / t_1;
	} else if (x <= 0.0027) {
		tmp = (Math.pow(x, 4.0) * -0.0859375) + (x * (x * 0.125));
	} else {
		tmp = (1.0 / t_1) * (0.5 + (-0.5 / Math.hypot(1.0, x)));
	}
	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 + (0.5 / math.hypot(1.0, x))
	t_1 = 1.0 + math.sqrt(t_0)
	t_2 = (x * x) + 1.0
	tmp = 0
	if x <= -0.002:
		tmp = ((0.0625 + (-0.0625 / (t_2 * t_2))) / (t_0 * (0.25 + (0.25 / t_2)))) / t_1
	elif x <= 0.0027:
		tmp = (math.pow(x, 4.0) * -0.0859375) + (x * (x * 0.125))
	else:
		tmp = (1.0 / t_1) * (0.5 + (-0.5 / math.hypot(1.0, x)))
	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 + Float64(0.5 / hypot(1.0, x)))
	t_1 = Float64(1.0 + sqrt(t_0))
	t_2 = Float64(Float64(x * x) + 1.0)
	tmp = 0.0
	if (x <= -0.002)
		tmp = Float64(Float64(Float64(0.0625 + Float64(-0.0625 / Float64(t_2 * t_2))) / Float64(t_0 * Float64(0.25 + Float64(0.25 / t_2)))) / t_1);
	elseif (x <= 0.0027)
		tmp = Float64(Float64((x ^ 4.0) * -0.0859375) + Float64(x * Float64(x * 0.125)));
	else
		tmp = Float64(Float64(1.0 / t_1) * Float64(0.5 + Float64(-0.5 / hypot(1.0, x))));
	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 + (0.5 / hypot(1.0, x));
	t_1 = 1.0 + sqrt(t_0);
	t_2 = (x * x) + 1.0;
	tmp = 0.0;
	if (x <= -0.002)
		tmp = ((0.0625 + (-0.0625 / (t_2 * t_2))) / (t_0 * (0.25 + (0.25 / t_2)))) / t_1;
	elseif (x <= 0.0027)
		tmp = ((x ^ 4.0) * -0.0859375) + (x * (x * 0.125));
	else
		tmp = (1.0 / t_1) * (0.5 + (-0.5 / hypot(1.0, x)));
	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[(0.5 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -0.002], N[(N[(N[(0.0625 + N[(-0.0625 / N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * N[(0.25 + N[(0.25 / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[x, 0.0027], N[(N[(N[Power[x, 4.0], $MachinePrecision] * -0.0859375), $MachinePrecision] + N[(x * N[(x * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$1), $MachinePrecision] * N[(0.5 + N[(-0.5 / N[Sqrt[1.0 ^ 2 + x ^ 2], $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 := 0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\
t_1 := 1 + \sqrt{t_0}\\
t_2 := x \cdot x + 1\\
\mathbf{if}\;x \leq -0.002:\\
\;\;\;\;\frac{\frac{0.0625 + \frac{-0.0625}{t_2 \cdot t_2}}{t_0 \cdot \left(0.25 + \frac{0.25}{t_2}\right)}}{t_1}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1} \cdot \left(0.5 + \frac{-0.5}{\mathsf{hypot}\left(1, x\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 < -2e-3

    1. Initial program 1.0

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

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

      [Start]1.0

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

      distribute-lft-in [=>]1.0

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

      metadata-eval [=>]1.0

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

      associate-*r/ [=>]1.0

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

      metadata-eval [=>]1.0

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

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

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

      [Start]1.1

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

      sqr-neg [=>]1.1

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

      rem-square-sqrt [=>]0.1

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

      associate--r+ [=>]0.1

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

      metadata-eval [=>]0.1

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

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

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

      [Start]0.1

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

      associate-*l/ [=>]0.1

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

      associate-*r/ [=>]0.1

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

      metadata-eval [=>]0.1

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

      associate-/l/ [=>]0.1

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

      +-commutative [=>]0.1

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

      +-commutative [=>]0.1

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

      sub-neg [=>]0.1

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

      distribute-neg-frac [=>]0.1

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

      metadata-eval [=>]0.1

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

      +-commutative [=>]0.1

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

    if -2e-3 < x < 0.0027000000000000001

    1. Initial program 30.1

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

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

      [Start]30.1

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

      distribute-lft-in [=>]30.1

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

      metadata-eval [=>]30.1

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

      associate-*r/ [=>]30.1

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

      metadata-eval [=>]30.1

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

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

      \[\leadsto \color{blue}{0.125 \cdot {x}^{2} + -0.0859375 \cdot {x}^{4}} \]
    5. Simplified0.0

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.125, x \cdot x, {x}^{4} \cdot -0.0859375\right)} \]
      Proof

      [Start]0.0

      \[ 0.125 \cdot {x}^{2} + -0.0859375 \cdot {x}^{4} \]

      fma-def [=>]0.0

      \[ \color{blue}{\mathsf{fma}\left(0.125, {x}^{2}, -0.0859375 \cdot {x}^{4}\right)} \]

      unpow2 [=>]0.0

      \[ \mathsf{fma}\left(0.125, \color{blue}{x \cdot x}, -0.0859375 \cdot {x}^{4}\right) \]

      *-commutative [=>]0.0

      \[ \mathsf{fma}\left(0.125, x \cdot x, \color{blue}{{x}^{4} \cdot -0.0859375}\right) \]
    6. Applied egg-rr0.0

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

    if 0.0027000000000000001 < x

    1. Initial program 1.0

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

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

      [Start]1.0

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

      distribute-lft-in [=>]1.0

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

      metadata-eval [=>]1.0

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

      associate-*r/ [=>]1.0

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

      metadata-eval [=>]1.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.002:\\ \;\;\;\;\frac{\frac{0.0625 + \frac{-0.0625}{\left(x \cdot x + 1\right) \cdot \left(x \cdot x + 1\right)}}{\left(0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\right) \cdot \left(0.25 + \frac{0.25}{x \cdot x + 1}\right)}}{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}\\ \mathbf{elif}\;x \leq 0.0027:\\ \;\;\;\;{x}^{4} \cdot -0.0859375 + x \cdot \left(x \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}} \cdot \left(0.5 + \frac{-0.5}{\mathsf{hypot}\left(1, x\right)}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error0.1
Cost26756
\[\begin{array}{l} \mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.0002:\\ \;\;\;\;{x}^{4} \cdot -0.0859375 + x \cdot \left(x \cdot 0.125\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 2
Error0.1
Cost20552
\[\begin{array}{l} t_0 := 0.5 + \frac{-0.5}{\mathsf{hypot}\left(1, x\right)}\\ t_1 := 1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\\ \mathbf{if}\;x \leq -0.0022:\\ \;\;\;\;\frac{t_0}{t_1}\\ \mathbf{elif}\;x \leq 0.0027:\\ \;\;\;\;{x}^{4} \cdot -0.0859375 + x \cdot \left(x \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_1} \cdot t_0\\ \end{array} \]
Alternative 3
Error0.3
Cost14088
\[\begin{array}{l} t_0 := 0.5 + \frac{-0.5}{x}\\ \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{\left(0.25 + \frac{\frac{-0.25}{x}}{x}\right) \cdot \frac{1}{1 + \sqrt{t_0}}}{t_0}\\ \mathbf{elif}\;x \leq 1.1:\\ \;\;\;\;{x}^{4} \cdot -0.0859375 + x \cdot \left(x \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}} \cdot t_0\\ \end{array} \]
Alternative 4
Error0.3
Cost8004
\[\begin{array}{l} t_0 := 0.5 + \frac{-0.5}{x}\\ \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{\left(0.25 + \frac{\frac{-0.25}{x}}{x}\right) \cdot \frac{1}{1 + \sqrt{t_0}}}{t_0}\\ \mathbf{elif}\;x \leq 1.1:\\ \;\;\;\;{x}^{4} \cdot -0.0859375 + x \cdot \left(x \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \frac{1}{1 + \sqrt{0.5 - \frac{-0.5}{x}}}\\ \end{array} \]
Alternative 5
Error0.6
Cost7624
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\ \mathbf{elif}\;x \leq 1.1:\\ \;\;\;\;{x}^{4} \cdot -0.0859375 + x \cdot \left(x \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 + \frac{-0.5}{x}\right) \cdot \frac{1}{1 + \sqrt{0.5 - \frac{-0.5}{x}}}\\ \end{array} \]
Alternative 6
Error0.6
Cost7496
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\ \mathbf{elif}\;x \leq 1.1:\\ \;\;\;\;{x}^{4} \cdot -0.0859375 + x \cdot \left(x \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 + \frac{-0.5}{x}}{1 + \sqrt{0.5 - \frac{-0.5}{x}}}\\ \end{array} \]
Alternative 7
Error0.8
Cost7304
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\ \mathbf{elif}\;x \leq 1.1:\\ \;\;\;\;{x}^{4} \cdot -0.0859375 + x \cdot \left(x \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \sqrt{0.5 - \frac{-0.5}{x}}\\ \end{array} \]
Alternative 8
Error1.0
Cost7112
\[\begin{array}{l} \mathbf{if}\;x \leq -1.55:\\ \;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\ \mathbf{elif}\;x \leq 1.25:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.125\\ \mathbf{else}:\\ \;\;\;\;1 - \sqrt{0.5 - \frac{-0.5}{x}}\\ \end{array} \]
Alternative 9
Error1.0
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -1.55 \lor \neg \left(x \leq 1.55\right):\\ \;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.125\\ \end{array} \]
Alternative 10
Error1.4
Cost6857
\[\begin{array}{l} \mathbf{if}\;x \leq -1.55 \lor \neg \left(x \leq 1.55\right):\\ \;\;\;\;1 - \sqrt{0.5}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.125\\ \end{array} \]
Alternative 11
Error25.5
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -1.45:\\ \;\;\;\;0.25\\ \mathbf{elif}\;x \leq 1.8:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.125\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 - \frac{-0.5}{x}}{2}\\ \end{array} \]
Alternative 12
Error25.5
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -1.8:\\ \;\;\;\;\frac{0.5 + \frac{-0.5}{x}}{2}\\ \mathbf{elif}\;x \leq 1.8:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.125\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 - \frac{-0.5}{x}}{2}\\ \end{array} \]
Alternative 13
Error25.5
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1.45:\\ \;\;\;\;0.25\\ \mathbf{elif}\;x \leq 1.4:\\ \;\;\;\;\left(x \cdot x\right) \cdot 0.125\\ \mathbf{else}:\\ \;\;\;\;0.25\\ \end{array} \]
Alternative 14
Error40.0
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{-77}:\\ \;\;\;\;0.25\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{-77}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;0.25\\ \end{array} \]
Alternative 15
Error61.1
Cost192
\[x \cdot 0.015625 \]
Alternative 16
Error46.7
Cost64
\[0 \]

Error

Reproduce?

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