Average Error: 31.9 → 12.3
Time: 8.9s
Precision: binary64
Cost: 8528
\[\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 := x \cdot x + y \cdot \left(y \cdot -4\right)\\ \mathbf{if}\;t_0 \leq 2 \cdot 10^{-289}:\\ \;\;\;\;1 + \frac{\frac{y}{x}}{\frac{x}{y \cdot -8}}\\ \mathbf{elif}\;t_0 \leq 4 \cdot 10^{-89}:\\ \;\;\;\;\frac{t_1}{\mathsf{fma}\left(x, x, t_0\right)}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{-36}:\\ \;\;\;\;1 + \left(y \cdot -8\right) \cdot \frac{y}{x \cdot x}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+228}:\\ \;\;\;\;\frac{t_1}{t_0 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -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 (+ (* x x) (* y (* y -4.0)))))
   (if (<= t_0 2e-289)
     (+ 1.0 (/ (/ y x) (/ x (* y -8.0))))
     (if (<= t_0 4e-89)
       (/ t_1 (fma x x t_0))
       (if (<= t_0 5e-36)
         (+ 1.0 (* (* y -8.0) (/ y (* x x))))
         (if (<= t_0 2e+228)
           (/ t_1 (+ t_0 (* x x)))
           (fma 0.5 (* (/ x y) (/ x y)) -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 = (x * x) + (y * (y * -4.0));
	double tmp;
	if (t_0 <= 2e-289) {
		tmp = 1.0 + ((y / x) / (x / (y * -8.0)));
	} else if (t_0 <= 4e-89) {
		tmp = t_1 / fma(x, x, t_0);
	} else if (t_0 <= 5e-36) {
		tmp = 1.0 + ((y * -8.0) * (y / (x * x)));
	} else if (t_0 <= 2e+228) {
		tmp = t_1 / (t_0 + (x * x));
	} else {
		tmp = fma(0.5, ((x / y) * (x / y)), -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(Float64(x * x) + Float64(y * Float64(y * -4.0)))
	tmp = 0.0
	if (t_0 <= 2e-289)
		tmp = Float64(1.0 + Float64(Float64(y / x) / Float64(x / Float64(y * -8.0))));
	elseif (t_0 <= 4e-89)
		tmp = Float64(t_1 / fma(x, x, t_0));
	elseif (t_0 <= 5e-36)
		tmp = Float64(1.0 + Float64(Float64(y * -8.0) * Float64(y / Float64(x * x))));
	elseif (t_0 <= 2e+228)
		tmp = Float64(t_1 / Float64(t_0 + Float64(x * x)));
	else
		tmp = fma(0.5, Float64(Float64(x / y) * Float64(x / y)), -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[(N[(x * x), $MachinePrecision] + N[(y * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-289], N[(1.0 + N[(N[(y / x), $MachinePrecision] / N[(x / N[(y * -8.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e-89], N[(t$95$1 / N[(x * x + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-36], N[(1.0 + N[(N[(y * -8.0), $MachinePrecision] * N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+228], N[(t$95$1 / N[(t$95$0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + -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 := x \cdot x + y \cdot \left(y \cdot -4\right)\\
\mathbf{if}\;t_0 \leq 2 \cdot 10^{-289}:\\
\;\;\;\;1 + \frac{\frac{y}{x}}{\frac{x}{y \cdot -8}}\\

\mathbf{elif}\;t_0 \leq 4 \cdot 10^{-89}:\\
\;\;\;\;\frac{t_1}{\mathsf{fma}\left(x, x, t_0\right)}\\

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-36}:\\
\;\;\;\;1 + \left(y \cdot -8\right) \cdot \frac{y}{x \cdot x}\\

\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+228}:\\
\;\;\;\;\frac{t_1}{t_0 + x \cdot x}\\

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


\end{array}

Error

Target

Original31.9
Target31.6
Herbie12.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 5 regimes
  2. if (*.f64 (*.f64 y 4) y) < 2e-289

    1. Initial program 30.1

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Taylor expanded in x around inf 16.2

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

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

      [Start]16.2

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

      cancel-sign-sub-inv [=>]16.2

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

      metadata-eval [=>]16.2

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

      associate-+l+ [=>]16.2

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

      associate-*r/ [=>]16.2

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

      *-commutative [=>]16.2

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

      unpow2 [=>]16.2

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

      associate-*r* [<=]16.2

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

      unpow2 [=>]16.2

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

      associate-/l* [=>]16.2

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

      associate-*r/ [=>]16.2

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

      *-commutative [=>]16.2

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

      unpow2 [=>]16.2

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

      associate-*r* [<=]16.2

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

      unpow2 [=>]16.2

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

      associate-/l* [=>]16.2

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

      \[\leadsto 1 + \color{blue}{\frac{y}{x \cdot x} \cdot \left(y \cdot -8\right)} \]
    5. Applied egg-rr8.5

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

    if 2e-289 < (*.f64 (*.f64 y 4) y) < 4.00000000000000015e-89

    1. Initial program 15.0

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

      \[\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]15.0

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

      *-commutative [=>]15.0

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

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

      \[ \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.00000000000000015e-89 < (*.f64 (*.f64 y 4) y) < 5.00000000000000004e-36

    1. Initial program 16.6

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Taylor expanded in x around inf 27.0

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

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

      [Start]27.0

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

      cancel-sign-sub-inv [=>]27.0

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

      metadata-eval [=>]27.0

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

      associate-+l+ [=>]27.0

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

      associate-*r/ [=>]27.0

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

      *-commutative [=>]27.0

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

      unpow2 [=>]27.0

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

      associate-*r* [<=]27.0

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

      unpow2 [=>]27.0

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

      associate-/l* [=>]27.0

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

      associate-*r/ [=>]27.0

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

      *-commutative [=>]27.0

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

      unpow2 [=>]27.0

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

      associate-*r* [<=]27.0

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

      unpow2 [=>]27.0

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

      associate-/l* [=>]27.0

      \[ 1 + \left(\frac{y}{\frac{x \cdot x}{y \cdot -4}} + \color{blue}{\frac{y}{\frac{x \cdot x}{y \cdot -4}}}\right) \]
    4. Applied egg-rr27.0

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

    if 5.00000000000000004e-36 < (*.f64 (*.f64 y 4) y) < 1.9999999999999998e228

    1. Initial program 16.0

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

    if 1.9999999999999998e228 < (*.f64 (*.f64 y 4) y)

    1. Initial program 54.2

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Simplified54.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]54.2

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

      *-commutative [=>]54.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 [=>]54.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 [=>]54.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 0 16.6

      \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1} \]
    4. Simplified9.7

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

      [Start]16.6

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

      fma-neg [=>]16.6

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

      unpow2 [=>]16.6

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

      unpow2 [=>]16.6

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

      times-frac [=>]9.7

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

      metadata-eval [=>]9.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 2 \cdot 10^{-289}:\\ \;\;\;\;1 + \frac{\frac{y}{x}}{\frac{x}{y \cdot -8}}\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 4 \cdot 10^{-89}:\\ \;\;\;\;\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{elif}\;y \cdot \left(y \cdot 4\right) \leq 5 \cdot 10^{-36}:\\ \;\;\;\;1 + \left(y \cdot -8\right) \cdot \frac{y}{x \cdot x}\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 2 \cdot 10^{+228}:\\ \;\;\;\;\frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \end{array} \]

Alternatives

Alternative 1
Error12.3
Cost8528
\[\begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{t_0 + x \cdot x}\\ \mathbf{if}\;t_0 \leq 2 \cdot 10^{-289}:\\ \;\;\;\;1 + \frac{\frac{y}{x}}{\frac{x}{y \cdot -8}}\\ \mathbf{elif}\;t_0 \leq 4 \cdot 10^{-89}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{-36}:\\ \;\;\;\;1 + \left(y \cdot -8\right) \cdot \frac{y}{x \cdot x}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+228}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \end{array} \]
Alternative 2
Error12.4
Cost2768
\[\begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{t_0 + x \cdot x}\\ \mathbf{if}\;t_0 \leq 2 \cdot 10^{-289}:\\ \;\;\;\;1 + \frac{\frac{y}{x}}{\frac{x}{y \cdot -8}}\\ \mathbf{elif}\;t_0 \leq 4 \cdot 10^{-89}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{-36}:\\ \;\;\;\;1 + \left(y \cdot -8\right) \cdot \frac{y}{x \cdot x}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+228}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y \cdot 4}\\ \end{array} \]
Alternative 3
Error16.2
Cost1868
\[\begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ \mathbf{if}\;t_0 \leq 2 \cdot 10^{-139}:\\ \;\;\;\;1 + \frac{\frac{y}{x}}{\frac{x}{y \cdot -8}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{-91}:\\ \;\;\;\;-1\\ \mathbf{elif}\;t_0 \leq 10^{-11}:\\ \;\;\;\;1 + \left(y \cdot -8\right) \cdot \frac{y}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y \cdot 4}\\ \end{array} \]
Alternative 4
Error17.5
Cost1496
\[\begin{array}{l} t_0 := 1 + \left(y \cdot -8\right) \cdot \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -240000000000:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -3.4 \cdot 10^{-46}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-78}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{-19}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{+123}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 10^{+158}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 5
Error17.3
Cost1496
\[\begin{array}{l} t_0 := 1 + \left(y \cdot -8\right) \cdot \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -2700:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -3.45 \cdot 10^{-46}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7.2 \cdot 10^{-81}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 1.66 \cdot 10^{-18}:\\ \;\;\;\;1 + \frac{\frac{y}{x}}{\frac{x}{y \cdot -8}}\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{+123}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 10^{+158}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 6
Error16.7
Cost592
\[\begin{array}{l} \mathbf{if}\;y \leq -460000:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq -3.2 \cdot 10^{-46}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-78}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{-19}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 7
Error31.2
Cost64
\[-1 \]

Error

Reproduce

herbie shell --seed 2022354 
(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))))