?

Average Accuracy: 50.1% → 80.3%
Time: 13.9s
Precision: binary64
Cost: 33612

?

\[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
\[\begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := {\left(\frac{x}{y}\right)}^{2}\\ t_2 := \frac{\mathsf{fma}\left(0.25, t_1, -1\right)}{\sqrt{\mathsf{fma}\left(t_1, 0.5, 1\right)}}\\ t_3 := x \cdot x - t_0\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-318}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-267}:\\ \;\;\;\;\frac{t_3}{x \cdot x + t_0}\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-107}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+306}:\\ \;\;\;\;\frac{t_3}{\mathsf{fma}\left(x, x, t_0\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\ \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0)))
        (t_1 (pow (/ x y) 2.0))
        (t_2 (/ (fma 0.25 t_1 -1.0) (sqrt (fma t_1 0.5 1.0))))
        (t_3 (- (* x x) t_0)))
   (if (<= (* x x) 5e-318)
     t_2
     (if (<= (* x x) 4e-267)
       (/ t_3 (+ (* x x) t_0))
       (if (<= (* x x) 2e-107)
         t_2
         (if (<= (* x x) 4e+306)
           (/ t_3 (fma x x t_0))
           (fma (* (/ y x) (/ y x)) -8.0 1.0)))))))
double code(double x, double y) {
	return ((x * x) - ((y * 4.0) * y)) / ((x * x) + ((y * 4.0) * y));
}
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = pow((x / y), 2.0);
	double t_2 = fma(0.25, t_1, -1.0) / sqrt(fma(t_1, 0.5, 1.0));
	double t_3 = (x * x) - t_0;
	double tmp;
	if ((x * x) <= 5e-318) {
		tmp = t_2;
	} else if ((x * x) <= 4e-267) {
		tmp = t_3 / ((x * x) + t_0);
	} else if ((x * x) <= 2e-107) {
		tmp = t_2;
	} else if ((x * x) <= 4e+306) {
		tmp = t_3 / fma(x, x, t_0);
	} else {
		tmp = fma(((y / x) * (y / x)), -8.0, 1.0);
	}
	return tmp;
}
function code(x, y)
	return Float64(Float64(Float64(x * x) - Float64(Float64(y * 4.0) * y)) / Float64(Float64(x * x) + Float64(Float64(y * 4.0) * y)))
end
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	t_1 = Float64(x / y) ^ 2.0
	t_2 = Float64(fma(0.25, t_1, -1.0) / sqrt(fma(t_1, 0.5, 1.0)))
	t_3 = Float64(Float64(x * x) - t_0)
	tmp = 0.0
	if (Float64(x * x) <= 5e-318)
		tmp = t_2;
	elseif (Float64(x * x) <= 4e-267)
		tmp = Float64(t_3 / Float64(Float64(x * x) + t_0));
	elseif (Float64(x * x) <= 2e-107)
		tmp = t_2;
	elseif (Float64(x * x) <= 4e+306)
		tmp = Float64(t_3 / fma(x, x, t_0));
	else
		tmp = fma(Float64(Float64(y / x) * Float64(y / x)), -8.0, 1.0);
	end
	return tmp
end
code[x_, y_] := N[(N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(0.25 * t$95$1 + -1.0), $MachinePrecision] / N[Sqrt[N[(t$95$1 * 0.5 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e-318], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 4e-267], N[(t$95$3 / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 2e-107], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 4e+306], N[(t$95$3 / N[(x * x + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] * -8.0 + 1.0), $MachinePrecision]]]]]]]]]
\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y}
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := {\left(\frac{x}{y}\right)}^{2}\\
t_2 := \frac{\mathsf{fma}\left(0.25, t_1, -1\right)}{\sqrt{\mathsf{fma}\left(t_1, 0.5, 1\right)}}\\
t_3 := x \cdot x - t_0\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-318}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-267}:\\
\;\;\;\;\frac{t_3}{x \cdot x + t_0}\\

\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-107}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+306}:\\
\;\;\;\;\frac{t_3}{\mathsf{fma}\left(x, x, t_0\right)}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\


\end{array}

Error?

Target

Original50.1%
Target50.5%
Herbie80.3%
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} < 0.9743233849626781:\\ \;\;\;\;\frac{x \cdot x}{x \cdot x + \left(y \cdot y\right) \cdot 4} - \frac{\left(y \cdot y\right) \cdot 4}{x \cdot x + \left(y \cdot y\right) \cdot 4}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x}{\sqrt{x \cdot x + \left(y \cdot y\right) \cdot 4}}\right)}^{2} - \frac{\left(y \cdot y\right) \cdot 4}{x \cdot x + \left(y \cdot y\right) \cdot 4}\\ \end{array} \]

Derivation?

  1. Split input into 4 regimes
  2. if (*.f64 x x) < 4.9999987e-318 or 3.9999999999999999e-267 < (*.f64 x x) < 2e-107

    1. Initial program 59.4%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Simplified59.4%

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

      [Start]59.4

      \[ \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]

      *-commutative [=>]59.4

      \[ \frac{x \cdot x - \color{blue}{y \cdot \left(y \cdot 4\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]

      fma-def [=>]59.4

      \[ \frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\color{blue}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}} \]

      *-commutative [=>]59.4

      \[ \frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\mathsf{fma}\left(x, x, \color{blue}{y \cdot \left(y \cdot 4\right)}\right)} \]
    3. Taylor expanded in x around 0 73.1%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1} \]
    4. Simplified80.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)} \]
      Proof

      [Start]73.1

      \[ 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1 \]

      fma-neg [=>]73.1

      \[ \color{blue}{\mathsf{fma}\left(0.5, \frac{{x}^{2}}{{y}^{2}}, -1\right)} \]

      unpow2 [=>]73.1

      \[ \mathsf{fma}\left(0.5, \frac{\color{blue}{x \cdot x}}{{y}^{2}}, -1\right) \]

      unpow2 [=>]73.1

      \[ \mathsf{fma}\left(0.5, \frac{x \cdot x}{\color{blue}{y \cdot y}}, -1\right) \]

      times-frac [=>]80.6

      \[ \mathsf{fma}\left(0.5, \color{blue}{\frac{x}{y} \cdot \frac{x}{y}}, -1\right) \]

      metadata-eval [=>]80.6

      \[ \mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, \color{blue}{-1}\right) \]
    5. Applied egg-rr80.6%

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

      [Start]80.6

      \[ \mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right) \]

      fma-udef [=>]80.6

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

      *-commutative [=>]80.6

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

      pow2 [=>]80.6

      \[ \color{blue}{{\left(\frac{x}{y}\right)}^{2}} \cdot 0.5 + -1 \]
    6. Applied egg-rr80.4%

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

      [Start]80.6

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

      flip-+ [=>]80.4

      \[ \color{blue}{\frac{\left({\left(\frac{x}{y}\right)}^{2} \cdot 0.5\right) \cdot \left({\left(\frac{x}{y}\right)}^{2} \cdot 0.5\right) - -1 \cdot -1}{{\left(\frac{x}{y}\right)}^{2} \cdot 0.5 - -1}} \]

      add-sqr-sqrt [=>]80.4

      \[ \frac{\left({\left(\frac{x}{y}\right)}^{2} \cdot 0.5\right) \cdot \left({\left(\frac{x}{y}\right)}^{2} \cdot 0.5\right) - -1 \cdot -1}{\color{blue}{\sqrt{{\left(\frac{x}{y}\right)}^{2} \cdot 0.5 - -1} \cdot \sqrt{{\left(\frac{x}{y}\right)}^{2} \cdot 0.5 - -1}}} \]

      associate-/r* [=>]80.4

      \[ \color{blue}{\frac{\frac{\left({\left(\frac{x}{y}\right)}^{2} \cdot 0.5\right) \cdot \left({\left(\frac{x}{y}\right)}^{2} \cdot 0.5\right) - -1 \cdot -1}{\sqrt{{\left(\frac{x}{y}\right)}^{2} \cdot 0.5 - -1}}}{\sqrt{{\left(\frac{x}{y}\right)}^{2} \cdot 0.5 - -1}}} \]
    7. Taylor expanded in x around 0 73.2%

      \[\leadsto \frac{\color{blue}{0.25 \cdot \frac{{x}^{2}}{{y}^{2}} - 1}}{\sqrt{\mathsf{fma}\left({\left(\frac{x}{y}\right)}^{2}, 0.5, 1\right)}} \]
    8. Simplified80.9%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(0.25, {\left(\frac{x}{y}\right)}^{2}, -1\right)}}{\sqrt{\mathsf{fma}\left({\left(\frac{x}{y}\right)}^{2}, 0.5, 1\right)}} \]
      Proof

      [Start]73.2

      \[ \frac{0.25 \cdot \frac{{x}^{2}}{{y}^{2}} - 1}{\sqrt{\mathsf{fma}\left({\left(\frac{x}{y}\right)}^{2}, 0.5, 1\right)}} \]

      fma-neg [=>]73.2

      \[ \frac{\color{blue}{\mathsf{fma}\left(0.25, \frac{{x}^{2}}{{y}^{2}}, -1\right)}}{\sqrt{\mathsf{fma}\left({\left(\frac{x}{y}\right)}^{2}, 0.5, 1\right)}} \]

      unpow2 [=>]73.2

      \[ \frac{\mathsf{fma}\left(0.25, \frac{\color{blue}{x \cdot x}}{{y}^{2}}, -1\right)}{\sqrt{\mathsf{fma}\left({\left(\frac{x}{y}\right)}^{2}, 0.5, 1\right)}} \]

      unpow2 [=>]73.2

      \[ \frac{\mathsf{fma}\left(0.25, \frac{x \cdot x}{\color{blue}{y \cdot y}}, -1\right)}{\sqrt{\mathsf{fma}\left({\left(\frac{x}{y}\right)}^{2}, 0.5, 1\right)}} \]

      times-frac [=>]80.9

      \[ \frac{\mathsf{fma}\left(0.25, \color{blue}{\frac{x}{y} \cdot \frac{x}{y}}, -1\right)}{\sqrt{\mathsf{fma}\left({\left(\frac{x}{y}\right)}^{2}, 0.5, 1\right)}} \]

      unpow2 [<=]80.9

      \[ \frac{\mathsf{fma}\left(0.25, \color{blue}{{\left(\frac{x}{y}\right)}^{2}}, -1\right)}{\sqrt{\mathsf{fma}\left({\left(\frac{x}{y}\right)}^{2}, 0.5, 1\right)}} \]

      metadata-eval [=>]80.9

      \[ \frac{\mathsf{fma}\left(0.25, {\left(\frac{x}{y}\right)}^{2}, \color{blue}{-1}\right)}{\sqrt{\mathsf{fma}\left({\left(\frac{x}{y}\right)}^{2}, 0.5, 1\right)}} \]

    if 4.9999987e-318 < (*.f64 x x) < 3.9999999999999999e-267

    1. Initial program 73.9%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]

    if 2e-107 < (*.f64 x x) < 4.00000000000000007e306

    1. Initial program 74.2%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Simplified74.2%

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

      [Start]74.2

      \[ \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]

      *-commutative [=>]74.2

      \[ \frac{x \cdot x - \color{blue}{y \cdot \left(y \cdot 4\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]

      fma-def [=>]74.2

      \[ \frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\color{blue}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}} \]

      *-commutative [=>]74.2

      \[ \frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\mathsf{fma}\left(x, x, \color{blue}{y \cdot \left(y \cdot 4\right)}\right)} \]

    if 4.00000000000000007e306 < (*.f64 x x)

    1. Initial program 0.2%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Simplified0.2%

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

      [Start]0.2

      \[ \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]

      *-commutative [=>]0.2

      \[ \frac{x \cdot x - \color{blue}{y \cdot \left(y \cdot 4\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]

      fma-def [=>]0.2

      \[ \frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\color{blue}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}} \]

      *-commutative [=>]0.2

      \[ \frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\mathsf{fma}\left(x, x, \color{blue}{y \cdot \left(y \cdot 4\right)}\right)} \]
    3. Taylor expanded in x around inf 76.1%

      \[\leadsto \color{blue}{\left(1 + -4 \cdot \frac{{y}^{2}}{{x}^{2}}\right) - 4 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    4. Simplified88.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)} \]
      Proof

      [Start]76.1

      \[ \left(1 + -4 \cdot \frac{{y}^{2}}{{x}^{2}}\right) - 4 \cdot \frac{{y}^{2}}{{x}^{2}} \]

      associate--l+ [=>]76.1

      \[ \color{blue}{1 + \left(-4 \cdot \frac{{y}^{2}}{{x}^{2}} - 4 \cdot \frac{{y}^{2}}{{x}^{2}}\right)} \]

      +-commutative [=>]76.1

      \[ \color{blue}{\left(-4 \cdot \frac{{y}^{2}}{{x}^{2}} - 4 \cdot \frac{{y}^{2}}{{x}^{2}}\right) + 1} \]

      distribute-rgt-out-- [=>]76.1

      \[ \color{blue}{\frac{{y}^{2}}{{x}^{2}} \cdot \left(-4 - 4\right)} + 1 \]

      metadata-eval [=>]76.1

      \[ \frac{{y}^{2}}{{x}^{2}} \cdot \color{blue}{-8} + 1 \]

      fma-def [=>]76.1

      \[ \color{blue}{\mathsf{fma}\left(\frac{{y}^{2}}{{x}^{2}}, -8, 1\right)} \]

      unpow2 [=>]76.1

      \[ \mathsf{fma}\left(\frac{\color{blue}{y \cdot y}}{{x}^{2}}, -8, 1\right) \]

      unpow2 [=>]76.1

      \[ \mathsf{fma}\left(\frac{y \cdot y}{\color{blue}{x \cdot x}}, -8, 1\right) \]

      times-frac [=>]88.6

      \[ \mathsf{fma}\left(\color{blue}{\frac{y}{x} \cdot \frac{y}{x}}, -8, 1\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification80.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-318}:\\ \;\;\;\;\frac{\mathsf{fma}\left(0.25, {\left(\frac{x}{y}\right)}^{2}, -1\right)}{\sqrt{\mathsf{fma}\left({\left(\frac{x}{y}\right)}^{2}, 0.5, 1\right)}}\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-267}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-107}:\\ \;\;\;\;\frac{\mathsf{fma}\left(0.25, {\left(\frac{x}{y}\right)}^{2}, -1\right)}{\sqrt{\mathsf{fma}\left({\left(\frac{x}{y}\right)}^{2}, 0.5, 1\right)}}\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+306}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy80.2%
Cost8528
\[\begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := x \cdot x - t_0\\ t_2 := -1 + 0.5 \cdot \frac{\frac{x}{\frac{y}{x}}}{y}\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-318}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-267}:\\ \;\;\;\;\frac{t_1}{x \cdot x + t_0}\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-107}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+306}:\\ \;\;\;\;\frac{t_1}{\mathsf{fma}\left(x, x, t_0\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\ \end{array} \]
Alternative 2
Accuracy80.2%
Cost8016
\[\begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\ t_2 := -1 + 0.5 \cdot \frac{\frac{x}{\frac{y}{x}}}{y}\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-318}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-267}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-107}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+306}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\ \end{array} \]
Alternative 3
Accuracy80.2%
Cost2256
\[\begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\ t_2 := -1 + 0.5 \cdot \frac{\frac{x}{\frac{y}{x}}}{y}\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-318}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-267}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-107}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+306}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{y}{x} \cdot \frac{y \cdot -4}{x}\\ \end{array} \]
Alternative 4
Accuracy75.2%
Cost969
\[\begin{array}{l} \mathbf{if}\;x \leq -14000000000000 \lor \neg \left(x \leq 230\right):\\ \;\;\;\;1 + \frac{y}{x} \cdot \frac{y \cdot -4}{x}\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 5
Accuracy75.6%
Cost969
\[\begin{array}{l} \mathbf{if}\;x \leq -46000000000 \lor \neg \left(x \leq 7.7 \cdot 10^{-7}\right):\\ \;\;\;\;1 + \frac{y}{x} \cdot \frac{y \cdot -4}{x}\\ \mathbf{else}:\\ \;\;\;\;-1 + 0.5 \cdot \frac{\frac{x}{\frac{y}{x}}}{y}\\ \end{array} \]
Alternative 6
Accuracy74.7%
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{+14}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 6 \cdot 10^{-20}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 7
Accuracy50.2%
Cost64
\[-1 \]

Error

Reproduce?

herbie shell --seed 2023138 
(FPCore (x y)
  :name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
  :precision binary64

  :herbie-target
  (if (< (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))) 0.9743233849626781) (- (/ (* x x) (+ (* x x) (* (* y y) 4.0))) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4.0)))) 2.0) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))))

  (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))