?

Average Accuracy: 75.6% → 99.7%
Time: 14.7s
Precision: binary64
Cost: 39560

?

\[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)}\\ \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{0.5 + \frac{0.5}{x}}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 0.027:\\ \;\;\;\;\mathsf{fma}\left(x, x \cdot 0.125, \mathsf{fma}\left(0.0673828125, {x}^{6}, \mathsf{fma}\left(-0.0859375, {x}^{4}, -0.056243896484375 \cdot {x}^{8}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25 + \frac{-0.25}{1 + x \cdot x}}{t_0 \cdot \left(1 + \sqrt{t_0}\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)))))
   (if (<= x -1.1)
     (/ (+ 0.5 (/ 0.5 x)) (+ 1.0 (sqrt (+ 0.5 (/ -0.5 x)))))
     (if (<= x 0.027)
       (fma
        x
        (* x 0.125)
        (fma
         0.0673828125
         (pow x 6.0)
         (fma -0.0859375 (pow x 4.0) (* -0.056243896484375 (pow x 8.0)))))
       (/ (+ 0.25 (/ -0.25 (+ 1.0 (* x x)))) (* t_0 (+ 1.0 (sqrt t_0))))))))
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 tmp;
	if (x <= -1.1) {
		tmp = (0.5 + (0.5 / x)) / (1.0 + sqrt((0.5 + (-0.5 / x))));
	} else if (x <= 0.027) {
		tmp = fma(x, (x * 0.125), fma(0.0673828125, pow(x, 6.0), fma(-0.0859375, pow(x, 4.0), (-0.056243896484375 * pow(x, 8.0)))));
	} else {
		tmp = (0.25 + (-0.25 / (1.0 + (x * x)))) / (t_0 * (1.0 + sqrt(t_0)));
	}
	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)))
	tmp = 0.0
	if (x <= -1.1)
		tmp = Float64(Float64(0.5 + Float64(0.5 / x)) / Float64(1.0 + sqrt(Float64(0.5 + Float64(-0.5 / x)))));
	elseif (x <= 0.027)
		tmp = fma(x, Float64(x * 0.125), fma(0.0673828125, (x ^ 6.0), fma(-0.0859375, (x ^ 4.0), Float64(-0.056243896484375 * (x ^ 8.0)))));
	else
		tmp = Float64(Float64(0.25 + Float64(-0.25 / Float64(1.0 + Float64(x * x)))) / Float64(t_0 * Float64(1.0 + sqrt(t_0))));
	end
	return 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]}, If[LessEqual[x, -1.1], N[(N[(0.5 + N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[Sqrt[N[(0.5 + N[(-0.5 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.027], N[(x * N[(x * 0.125), $MachinePrecision] + N[(0.0673828125 * N[Power[x, 6.0], $MachinePrecision] + N[(-0.0859375 * N[Power[x, 4.0], $MachinePrecision] + N[(-0.056243896484375 * N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.25 + N[(-0.25 / N[(1.0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * N[(1.0 + N[Sqrt[t$95$0], $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)}\\
\mathbf{if}\;x \leq -1.1:\\
\;\;\;\;\frac{0.5 + \frac{0.5}{x}}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\

\mathbf{elif}\;x \leq 0.027:\\
\;\;\;\;\mathsf{fma}\left(x, x \cdot 0.125, \mathsf{fma}\left(0.0673828125, {x}^{6}, \mathsf{fma}\left(-0.0859375, {x}^{4}, -0.056243896484375 \cdot {x}^{8}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{0.25 + \frac{-0.25}{1 + x \cdot x}}{t_0 \cdot \left(1 + \sqrt{t_0}\right)}\\


\end{array}

Error?

Derivation?

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

    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.8%

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

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

      [Start]97.8

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

      associate-*r/ [=>]97.8

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

      metadata-eval [=>]97.8

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

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

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

      sub-neg [=>]97.8

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

      flip-+ [=>]97.8

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

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

      [Start]97.8

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

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

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

      associate--r+ [=>]99.3

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

      metadata-eval [=>]99.3

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

    if -1.1000000000000001 < x < 0.0269999999999999997

    1. Initial program 52.2%

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

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

      [Start]52.2

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

      distribute-lft-in [=>]52.2

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

      metadata-eval [=>]52.2

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

      associate-*r/ [=>]52.2

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

      metadata-eval [=>]52.2

      \[ 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} + \left(-0.056243896484375 \cdot {x}^{8} + -0.0859375 \cdot {x}^{4}\right)\right)} \]
    4. Applied egg-rr52.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(0.125, x \cdot x, \mathsf{fma}\left(0.0673828125, {x}^{6}, \mathsf{fma}\left(-0.056243896484375, {x}^{8}, -0.0859375 \cdot {x}^{4}\right)\right)\right)\right)} - 1} \]
      Proof

      [Start]99.8

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

      expm1-log1p-u [=>]99.8

      \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + \left(-0.056243896484375 \cdot {x}^{8} + -0.0859375 \cdot {x}^{4}\right)\right)\right)\right)} \]

      expm1-udef [=>]52.0

      \[ \color{blue}{e^{\mathsf{log1p}\left(0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + \left(-0.056243896484375 \cdot {x}^{8} + -0.0859375 \cdot {x}^{4}\right)\right)\right)} - 1} \]

      fma-def [=>]52.0

      \[ e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(0.125, {x}^{2}, 0.0673828125 \cdot {x}^{6} + \left(-0.056243896484375 \cdot {x}^{8} + -0.0859375 \cdot {x}^{4}\right)\right)}\right)} - 1 \]

      unpow2 [=>]52.0

      \[ e^{\mathsf{log1p}\left(\mathsf{fma}\left(0.125, \color{blue}{x \cdot x}, 0.0673828125 \cdot {x}^{6} + \left(-0.056243896484375 \cdot {x}^{8} + -0.0859375 \cdot {x}^{4}\right)\right)\right)} - 1 \]

      fma-def [=>]52.0

      \[ e^{\mathsf{log1p}\left(\mathsf{fma}\left(0.125, x \cdot x, \color{blue}{\mathsf{fma}\left(0.0673828125, {x}^{6}, -0.056243896484375 \cdot {x}^{8} + -0.0859375 \cdot {x}^{4}\right)}\right)\right)} - 1 \]

      fma-def [=>]52.0

      \[ e^{\mathsf{log1p}\left(\mathsf{fma}\left(0.125, x \cdot x, \mathsf{fma}\left(0.0673828125, {x}^{6}, \color{blue}{\mathsf{fma}\left(-0.056243896484375, {x}^{8}, -0.0859375 \cdot {x}^{4}\right)}\right)\right)\right)} - 1 \]
    5. Simplified99.8%

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

      [Start]52.0

      \[ e^{\mathsf{log1p}\left(\mathsf{fma}\left(0.125, x \cdot x, \mathsf{fma}\left(0.0673828125, {x}^{6}, \mathsf{fma}\left(-0.056243896484375, {x}^{8}, -0.0859375 \cdot {x}^{4}\right)\right)\right)\right)} - 1 \]

      expm1-def [=>]99.8

      \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.125, x \cdot x, \mathsf{fma}\left(0.0673828125, {x}^{6}, \mathsf{fma}\left(-0.056243896484375, {x}^{8}, -0.0859375 \cdot {x}^{4}\right)\right)\right)\right)\right)} \]

      expm1-log1p [=>]99.8

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

      fma-udef [=>]99.8

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

      *-commutative [=>]99.8

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

      associate-*r* [<=]99.8

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

      fma-def [=>]99.8

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

      fma-def [<=]99.8

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

      +-commutative [=>]99.8

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

      fma-def [=>]99.8

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

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

      [Start]98.4

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

      flip-- [=>]98.4

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

      metadata-eval [=>]98.4

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

      add-sqr-sqrt [<=]99.9

      \[ \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+ [=>]99.9

      \[ \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 [=>]99.9

      \[ \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)}}} \]

      flip-- [=>]99.9

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

      associate-/l/ [=>]99.9

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

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

      [Start]99.9

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

      /-rgt-identity [<=]99.9

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

      /-rgt-identity [=>]99.9

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

      +-commutative [=>]99.9

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

      *-commutative [=>]99.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{0.5 + \frac{0.5}{x}}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 0.027:\\ \;\;\;\;\mathsf{fma}\left(x, x \cdot 0.125, \mathsf{fma}\left(0.0673828125, {x}^{6}, \mathsf{fma}\left(-0.0859375, {x}^{4}, -0.056243896484375 \cdot {x}^{8}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.25 + \frac{-0.25}{1 + x \cdot x}}{\left(0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\right) \cdot \left(1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\right)}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy99.7%
Cost27080
\[\begin{array}{l} t_0 := 0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\ \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{0.5 + \frac{0.5}{x}}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 0.027:\\ \;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + \left(-0.056243896484375 \cdot {x}^{8} + -0.0859375 \cdot {x}^{4}\right)\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 2
Accuracy99.7%
Cost26756
\[\begin{array}{l} \mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 2:\\ \;\;\;\;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 3
Accuracy99.7%
Cost26568
\[\begin{array}{l} t_0 := 0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\ \mathbf{if}\;x \leq -1.2:\\ \;\;\;\;\frac{0.5 + \frac{0.5}{x}}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 0.01:\\ \;\;\;\;\mathsf{fma}\left(x, x \cdot 0.125, \mathsf{fma}\left(0.0673828125, {x}^{6}, -0.0859375 \cdot {x}^{4}\right)\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 4
Accuracy99.7%
Cost21064
\[\begin{array}{l} t_0 := 0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\ \mathbf{if}\;x \leq -1.2:\\ \;\;\;\;\frac{0.5 + \frac{0.5}{x}}{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{0.25 + \frac{-0.25}{1 + x \cdot x}}{t_0 \cdot \left(1 + \sqrt{t_0}\right)}\\ \end{array} \]
Alternative 5
Accuracy99.4%
Cost20360
\[\begin{array}{l} t_0 := 0.5 + \frac{0.5}{x}\\ t_1 := 0.5 + \frac{-0.5}{x}\\ \mathbf{if}\;x \leq -1.2:\\ \;\;\;\;\frac{t_0}{1 + \sqrt{t_1}}\\ \mathbf{elif}\;x \leq 1.25:\\ \;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + \sqrt{t_0}} \cdot t_1\\ \end{array} \]
Alternative 6
Accuracy99.3%
Cost7624
\[\begin{array}{l} t_0 := 0.5 + \frac{0.5}{x}\\ t_1 := 0.5 + \frac{-0.5}{x}\\ \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{t_0}{1 + \sqrt{t_1}}\\ \mathbf{elif}\;x \leq 1.1:\\ \;\;\;\;x \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot -0.0859375, 0.125\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + \sqrt{t_0}} \cdot t_1\\ \end{array} \]
Alternative 7
Accuracy99.1%
Cost7364
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;\frac{0.5 + \frac{0.5}{x}}{1 + \sqrt{0.5 + \frac{-0.5}{x}}}\\ \mathbf{elif}\;x \leq 1.1:\\ \;\;\;\;x \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot -0.0859375, 0.125\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\ \end{array} \]
Alternative 8
Accuracy98.7%
Cost7240
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;1 - \sqrt{0.5 + \frac{-0.5}{x}}\\ \mathbf{elif}\;x \leq 1.1:\\ \;\;\;\;x \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot -0.0859375, 0.125\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\ \end{array} \]
Alternative 9
Accuracy98.7%
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1 \lor \neg \left(x \leq 1.1\right):\\ \;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(0.125 + -0.0859375 \cdot \left(x \cdot x\right)\right)\\ \end{array} \]
Alternative 10
Accuracy98.7%
Cost6984
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1:\\ \;\;\;\;1 - \sqrt{0.5 + \frac{-0.5}{x}}\\ \mathbf{elif}\;x \leq 1.1:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(0.125 + -0.0859375 \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\ \end{array} \]
Alternative 11
Accuracy98.0%
Cost6857
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1 \lor \neg \left(x \leq 1.1\right):\\ \;\;\;\;1 - \sqrt{0.5}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(0.125 + -0.0859375 \cdot \left(x \cdot x\right)\right)\\ \end{array} \]
Alternative 12
Accuracy50.3%
Cost320
\[0.125 \cdot \left(x \cdot x\right) \]
Alternative 13
Accuracy26.7%
Cost64
\[0 \]

Error

Reproduce?

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