Average Error: 31.5 → 14.2
Time: 7.7s
Precision: binary64
Cost: 27076
\[\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 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{t_0 + x \cdot x}\\ t_2 := {\left(\frac{y}{x}\right)}^{2}\\ t_3 := 2 + t_2\\ t_4 := \mathsf{fma}\left(\frac{2 \cdot t_2}{t_3}, -8, 1\right)\\ \mathbf{if}\;t_0 \leq 5 \cdot 10^{-264}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, t_2, 1\right) + -1}{t_3}, -8, 1\right)\\ \mathbf{elif}\;t_0 \leq 10^{-138}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{-109}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t_0 \leq 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 10^{+162}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t_0 \leq 10^{+171}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \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))) (+ t_0 (* x x))))
        (t_2 (pow (/ y x) 2.0))
        (t_3 (+ 2.0 t_2))
        (t_4 (fma (/ (* 2.0 t_2) t_3) -8.0 1.0)))
   (if (<= t_0 5e-264)
     (fma (/ (+ (fma 2.0 t_2 1.0) -1.0) t_3) -8.0 1.0)
     (if (<= t_0 1e-138)
       t_1
       (if (<= t_0 2e-109)
         t_4
         (if (<= t_0 1e+37)
           t_1
           (if (<= t_0 1e+162) t_4 (if (<= t_0 1e+171) t_1 -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))) / (t_0 + (x * x));
	double t_2 = pow((y / x), 2.0);
	double t_3 = 2.0 + t_2;
	double t_4 = fma(((2.0 * t_2) / t_3), -8.0, 1.0);
	double tmp;
	if (t_0 <= 5e-264) {
		tmp = fma(((fma(2.0, t_2, 1.0) + -1.0) / t_3), -8.0, 1.0);
	} else if (t_0 <= 1e-138) {
		tmp = t_1;
	} else if (t_0 <= 2e-109) {
		tmp = t_4;
	} else if (t_0 <= 1e+37) {
		tmp = t_1;
	} else if (t_0 <= 1e+162) {
		tmp = t_4;
	} else if (t_0 <= 1e+171) {
		tmp = t_1;
	} else {
		tmp = -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(Float64(x * x) + Float64(y * Float64(y * -4.0))) / Float64(t_0 + Float64(x * x)))
	t_2 = Float64(y / x) ^ 2.0
	t_3 = Float64(2.0 + t_2)
	t_4 = fma(Float64(Float64(2.0 * t_2) / t_3), -8.0, 1.0)
	tmp = 0.0
	if (t_0 <= 5e-264)
		tmp = fma(Float64(Float64(fma(2.0, t_2, 1.0) + -1.0) / t_3), -8.0, 1.0);
	elseif (t_0 <= 1e-138)
		tmp = t_1;
	elseif (t_0 <= 2e-109)
		tmp = t_4;
	elseif (t_0 <= 1e+37)
		tmp = t_1;
	elseif (t_0 <= 1e+162)
		tmp = t_4;
	elseif (t_0 <= 1e+171)
		tmp = t_1;
	else
		tmp = -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[(N[(x * x), $MachinePrecision] + N[(y * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(y / x), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(2.0 + t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(2.0 * t$95$2), $MachinePrecision] / t$95$3), $MachinePrecision] * -8.0 + 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-264], N[(N[(N[(N[(2.0 * t$95$2 + 1.0), $MachinePrecision] + -1.0), $MachinePrecision] / t$95$3), $MachinePrecision] * -8.0 + 1.0), $MachinePrecision], If[LessEqual[t$95$0, 1e-138], t$95$1, If[LessEqual[t$95$0, 2e-109], t$95$4, If[LessEqual[t$95$0, 1e+37], t$95$1, If[LessEqual[t$95$0, 1e+162], t$95$4, If[LessEqual[t$95$0, 1e+171], t$95$1, -1.0]]]]]]]]]]]
\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 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{t_0 + x \cdot x}\\
t_2 := {\left(\frac{y}{x}\right)}^{2}\\
t_3 := 2 + t_2\\
t_4 := \mathsf{fma}\left(\frac{2 \cdot t_2}{t_3}, -8, 1\right)\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-264}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, t_2, 1\right) + -1}{t_3}, -8, 1\right)\\

\mathbf{elif}\;t_0 \leq 10^{-138}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t_0 \leq 2 \cdot 10^{-109}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;t_0 \leq 10^{+37}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t_0 \leq 10^{+162}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;t_0 \leq 10^{+171}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;-1\\


\end{array}

Error

Target

Original31.5
Target31.2
Herbie14.2
\[\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 (*.f64 y 4) y) < 5.0000000000000001e-264

    1. Initial program 28.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 15.1

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)} \]
      Proof
      (fma.f64 (*.f64 (/.f64 y x) (/.f64 y x)) -8 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 y y) (*.f64 x x))) -8 1): 58 points increase in error, 7 points decrease in error
      (fma.f64 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 y 2)) (*.f64 x x)) -8 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (/.f64 (pow.f64 y 2) (Rewrite<= unpow2_binary64 (pow.f64 x 2))) -8 1): 0 points increase in error, 0 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (/.f64 (pow.f64 y 2) (pow.f64 x 2)) -8) 1)): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 -8 (/.f64 (pow.f64 y 2) (pow.f64 x 2)))) 1): 0 points increase in error, 0 points decrease in error
      (Rewrite=> +-commutative_binary64 (+.f64 1 (*.f64 -8 (/.f64 (pow.f64 y 2) (pow.f64 x 2))))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (Rewrite=> *-commutative_binary64 (*.f64 (/.f64 (pow.f64 y 2) (pow.f64 x 2)) -8))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (*.f64 (/.f64 (pow.f64 y 2) (pow.f64 x 2)) (Rewrite<= metadata-eval (-.f64 -4 4)))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (Rewrite<= distribute-rgt-out--_binary64 (-.f64 (*.f64 -4 (/.f64 (pow.f64 y 2) (pow.f64 x 2))) (*.f64 4 (/.f64 (pow.f64 y 2) (pow.f64 x 2)))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 1 (*.f64 -4 (/.f64 (pow.f64 y 2) (pow.f64 x 2)))) (*.f64 4 (/.f64 (pow.f64 y 2) (pow.f64 x 2))))): 0 points increase in error, 0 points decrease in error
    4. Applied egg-rr8.5

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(1 + {\left(\frac{y}{x}\right)}^{2}\right) - 1}, -8, 1\right) \]
    5. Applied egg-rr8.6

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{{\left(1 + {\left(\frac{y}{x}\right)}^{2}\right)}^{2} + -1}{{\left(\frac{y}{x}\right)}^{2} + 2}}, -8, 1\right) \]
    6. Taylor expanded in y around 0 15.1

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

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{fma}\left(2, {\left(\frac{y}{x}\right)}^{2}, 1\right)} + -1}{{\left(\frac{y}{x}\right)}^{2} + 2}, -8, 1\right) \]
      Proof
      (fma.f64 2 (pow.f64 (/.f64 y x) 2) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 2 (Rewrite=> unpow2_binary64 (*.f64 (/.f64 y x) (/.f64 y x))) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 2 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 y y) (*.f64 x x))) 1): 58 points increase in error, 7 points decrease in error
      (fma.f64 2 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 y 2)) (*.f64 x x)) 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 2 (/.f64 (pow.f64 y 2) (Rewrite<= unpow2_binary64 (pow.f64 x 2))) 1): 0 points increase in error, 0 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 2 (/.f64 (pow.f64 y 2) (pow.f64 x 2))) 1)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 1 (*.f64 2 (/.f64 (pow.f64 y 2) (pow.f64 x 2))))): 0 points increase in error, 0 points decrease in error

    if 5.0000000000000001e-264 < (*.f64 (*.f64 y 4) y) < 1.00000000000000007e-138 or 2e-109 < (*.f64 (*.f64 y 4) y) < 9.99999999999999954e36 or 9.9999999999999994e161 < (*.f64 (*.f64 y 4) y) < 9.99999999999999954e170

    1. Initial program 15.9

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

    if 1.00000000000000007e-138 < (*.f64 (*.f64 y 4) y) < 2e-109 or 9.99999999999999954e36 < (*.f64 (*.f64 y 4) y) < 9.9999999999999994e161

    1. Initial program 16.5

      \[\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 33.8

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)} \]
      Proof
      (fma.f64 (*.f64 (/.f64 y x) (/.f64 y x)) -8 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 y y) (*.f64 x x))) -8 1): 58 points increase in error, 7 points decrease in error
      (fma.f64 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 y 2)) (*.f64 x x)) -8 1): 0 points increase in error, 0 points decrease in error
      (fma.f64 (/.f64 (pow.f64 y 2) (Rewrite<= unpow2_binary64 (pow.f64 x 2))) -8 1): 0 points increase in error, 0 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (/.f64 (pow.f64 y 2) (pow.f64 x 2)) -8) 1)): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 -8 (/.f64 (pow.f64 y 2) (pow.f64 x 2)))) 1): 0 points increase in error, 0 points decrease in error
      (Rewrite=> +-commutative_binary64 (+.f64 1 (*.f64 -8 (/.f64 (pow.f64 y 2) (pow.f64 x 2))))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (Rewrite=> *-commutative_binary64 (*.f64 (/.f64 (pow.f64 y 2) (pow.f64 x 2)) -8))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (*.f64 (/.f64 (pow.f64 y 2) (pow.f64 x 2)) (Rewrite<= metadata-eval (-.f64 -4 4)))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (Rewrite<= distribute-rgt-out--_binary64 (-.f64 (*.f64 -4 (/.f64 (pow.f64 y 2) (pow.f64 x 2))) (*.f64 4 (/.f64 (pow.f64 y 2) (pow.f64 x 2)))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 1 (*.f64 -4 (/.f64 (pow.f64 y 2) (pow.f64 x 2)))) (*.f64 4 (/.f64 (pow.f64 y 2) (pow.f64 x 2))))): 0 points increase in error, 0 points decrease in error
    4. Applied egg-rr33.8

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(1 + {\left(\frac{y}{x}\right)}^{2}\right) - 1}, -8, 1\right) \]
    5. Applied egg-rr34.1

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{{\left(1 + {\left(\frac{y}{x}\right)}^{2}\right)}^{2} + -1}{{\left(\frac{y}{x}\right)}^{2} + 2}}, -8, 1\right) \]
    6. Taylor expanded in y around 0 32.4

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

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{2 \cdot {\left(\frac{y}{x}\right)}^{2}}}{{\left(\frac{y}{x}\right)}^{2} + 2}, -8, 1\right) \]
      Proof
      (*.f64 2 (pow.f64 (/.f64 y x) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 2 (Rewrite=> unpow2_binary64 (*.f64 (/.f64 y x) (/.f64 y x)))): 0 points increase in error, 0 points decrease in error
      (*.f64 2 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 y y) (*.f64 x x)))): 78 points increase in error, 12 points decrease in error
      (*.f64 2 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 y 2)) (*.f64 x x))): 0 points increase in error, 0 points decrease in error
      (*.f64 2 (/.f64 (pow.f64 y 2) (Rewrite<= unpow2_binary64 (pow.f64 x 2)))): 0 points increase in error, 0 points decrease in error

    if 9.99999999999999954e170 < (*.f64 (*.f64 y 4) y)

    1. Initial program 49.4

      \[\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 0 12.0

      \[\leadsto \color{blue}{-1} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification14.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 5 \cdot 10^{-264}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, {\left(\frac{y}{x}\right)}^{2}, 1\right) + -1}{2 + {\left(\frac{y}{x}\right)}^{2}}, -8, 1\right)\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 10^{-138}:\\ \;\;\;\;\frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 2 \cdot 10^{-109}:\\ \;\;\;\;\mathsf{fma}\left(\frac{2 \cdot {\left(\frac{y}{x}\right)}^{2}}{2 + {\left(\frac{y}{x}\right)}^{2}}, -8, 1\right)\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 10^{+37}:\\ \;\;\;\;\frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 10^{+162}:\\ \;\;\;\;\mathsf{fma}\left(\frac{2 \cdot {\left(\frac{y}{x}\right)}^{2}}{2 + {\left(\frac{y}{x}\right)}^{2}}, -8, 1\right)\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 10^{+171}:\\ \;\;\;\;\frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]

Alternatives

Alternative 1
Error14.2
Cost22100
\[\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}\\ t_2 := {\left(\frac{y}{x}\right)}^{2}\\ t_3 := \mathsf{fma}\left(\frac{2 \cdot t_2}{2 + t_2}, -8, 1\right)\\ \mathbf{if}\;t_0 \leq 5 \cdot 10^{-264}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_0 \leq 10^{-138}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{-109}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_0 \leq 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 10^{+162}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_0 \leq 10^{+171}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 2
Error14.5
Cost15380
\[\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}\\ t_2 := \mathsf{fma}\left(2 \cdot \left(-1 + \mathsf{hypot}\left(1, \frac{y}{x}\right)\right), -8, 1\right)\\ \mathbf{if}\;t_0 \leq 5 \cdot 10^{-264}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_0 \leq 10^{-138}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{-109}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_0 \leq 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 10^{+162}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_0 \leq 10^{+171}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 3
Error14.7
Cost8916
\[\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}\\ t_2 := \mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\ \mathbf{if}\;t_0 \leq 5 \cdot 10^{-264}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_0 \leq 10^{-138}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{-109}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_0 \leq 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 10^{+162}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_0 \leq 10^{+171}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 4
Error14.7
Cost8916
\[\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}\\ t_2 := \mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\ \mathbf{if}\;t_0 \leq 5 \cdot 10^{-264}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_0 \leq 10^{-138}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{-109}:\\ \;\;\;\;\mathsf{fma}\left(-1 + \left(1 + \frac{\frac{y}{x}}{\frac{x}{y}}\right), -8, 1\right)\\ \mathbf{elif}\;t_0 \leq 10^{+37}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 10^{+162}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_0 \leq 10^{+171}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 5
Error14.9
Cost3544
\[\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.989570214117516 \cdot 10^{-264}:\\ \;\;\;\;1\\ \mathbf{elif}\;t_0 \leq 8.46796549414556 \cdot 10^{-139}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 1.5258024938504115 \cdot 10^{-109}:\\ \;\;\;\;1\\ \mathbf{elif}\;t_0 \leq 8.147209021806546 \cdot 10^{+36}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 7.263606626515049 \cdot 10^{+161}:\\ \;\;\;\;1\\ \mathbf{elif}\;t_0 \leq 5.613012197670251 \cdot 10^{+170}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 6
Error17.0
Cost328
\[\begin{array}{l} \mathbf{if}\;y \leq -2.316326657371065 \cdot 10^{-45}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 3.968686997947988 \cdot 10^{+79}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 7
Error31.8
Cost64
\[1 \]

Error

Reproduce

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