?

Average Error: 31.8 → 4.6
Time: 13.3s
Precision: binary64
Cost: 26380

?

\[\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 := \frac{y}{\left(-y\right) - \frac{x}{y} \cdot \frac{x}{4}} - \frac{x}{\frac{\left(y \cdot y\right) \cdot -4 - x \cdot x}{x}}\\ t_1 := 1 + \left(y \cdot \frac{\frac{y}{x}}{x}\right) \cdot -8\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-116}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-171}:\\ \;\;\;\;\mathsf{fma}\left(0.5, e^{\log \left({\left(\frac{x}{y}\right)}^{2}\right)}, -1\right)\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{+152}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_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) (* (/ x y) (/ x 4.0))))
          (/ x (/ (- (* (* y y) -4.0) (* x x)) x))))
        (t_1 (+ 1.0 (* (* y (/ (/ y x) x)) -8.0))))
   (if (<= x -1.35e+154)
     t_1
     (if (<= x -2.3e-116)
       t_0
       (if (<= x 7e-171)
         (fma 0.5 (exp (log (pow (/ x y) 2.0))) -1.0)
         (if (<= x 4.6e+152) t_0 t_1))))))
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 - ((x / y) * (x / 4.0)))) - (x / ((((y * y) * -4.0) - (x * x)) / x));
	double t_1 = 1.0 + ((y * ((y / x) / x)) * -8.0);
	double tmp;
	if (x <= -1.35e+154) {
		tmp = t_1;
	} else if (x <= -2.3e-116) {
		tmp = t_0;
	} else if (x <= 7e-171) {
		tmp = fma(0.5, exp(log(pow((x / y), 2.0))), -1.0);
	} else if (x <= 4.6e+152) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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(Float64(y / Float64(Float64(-y) - Float64(Float64(x / y) * Float64(x / 4.0)))) - Float64(x / Float64(Float64(Float64(Float64(y * y) * -4.0) - Float64(x * x)) / x)))
	t_1 = Float64(1.0 + Float64(Float64(y * Float64(Float64(y / x) / x)) * -8.0))
	tmp = 0.0
	if (x <= -1.35e+154)
		tmp = t_1;
	elseif (x <= -2.3e-116)
		tmp = t_0;
	elseif (x <= 7e-171)
		tmp = fma(0.5, exp(log((Float64(x / y) ^ 2.0))), -1.0);
	elseif (x <= 4.6e+152)
		tmp = t_0;
	else
		tmp = t_1;
	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[(N[(y / N[((-y) - N[(N[(x / y), $MachinePrecision] * N[(x / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(N[(N[(y * y), $MachinePrecision] * -4.0), $MachinePrecision] - N[(x * x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(y * N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * -8.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+154], t$95$1, If[LessEqual[x, -2.3e-116], t$95$0, If[LessEqual[x, 7e-171], N[(0.5 * N[Exp[N[Log[N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[x, 4.6e+152], t$95$0, t$95$1]]]]]]
\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 := \frac{y}{\left(-y\right) - \frac{x}{y} \cdot \frac{x}{4}} - \frac{x}{\frac{\left(y \cdot y\right) \cdot -4 - x \cdot x}{x}}\\
t_1 := 1 + \left(y \cdot \frac{\frac{y}{x}}{x}\right) \cdot -8\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -2.3 \cdot 10^{-116}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq 7 \cdot 10^{-171}:\\
\;\;\;\;\mathsf{fma}\left(0.5, e^{\log \left({\left(\frac{x}{y}\right)}^{2}\right)}, -1\right)\\

\mathbf{elif}\;x \leq 4.6 \cdot 10^{+152}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error?

Target

Original31.8
Target31.6
Herbie4.6
\[\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 3 regimes
  2. if x < -1.35000000000000003e154 or 4.5999999999999997e152 < x

    1. Initial program 63.9

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

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

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

      [Start]17.7

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

      associate--l+ [=>]17.7

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

      unpow2 [=>]17.7

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

      unpow2 [=>]17.7

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

      associate-*r/ [=>]17.7

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

      *-commutative [=>]17.7

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

      unpow2 [=>]17.7

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

      associate-*r* [<=]17.7

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

      unpow2 [=>]17.7

      \[ 1 + \left(-4 \cdot \frac{y \cdot y}{x \cdot x} - \frac{y \cdot \left(y \cdot 4\right)}{\color{blue}{x \cdot x}}\right) \]
    4. Taylor expanded in y around 0 17.7

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

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

      [Start]17.7

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

      *-commutative [=>]17.7

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

      unpow2 [=>]17.7

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

      unpow2 [=>]17.7

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

      associate-*r/ [<=]9.1

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

      associate-/r* [=>]8.5

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

    if -1.35000000000000003e154 < x < -2.30000000000000002e-116 or 6.99999999999999988e-171 < x < 4.5999999999999997e152

    1. Initial program 16.7

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

      \[\leadsto \color{blue}{\frac{1}{y \cdot \left(y \cdot -4\right) - x \cdot x} \cdot \left(-\mathsf{fma}\left(x, x, y \cdot \left(y \cdot -4\right)\right)\right)} \]
    3. Applied egg-rr16.7

      \[\leadsto \color{blue}{\left(0 - \frac{x \cdot x}{y \cdot \left(y \cdot -4\right) - x \cdot x}\right) - \frac{y \cdot \left(y \cdot -4\right)}{y \cdot \left(y \cdot -4\right) - x \cdot x}} \]
    4. Simplified16.4

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

      [Start]16.7

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

      sub0-neg [=>]16.7

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

      associate-/l* [=>]16.9

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

      associate-*r* [=>]16.9

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

      associate-/l* [=>]16.4

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

      associate-*r* [=>]16.4

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

      \[\leadsto \left(-\frac{x}{\frac{\left(y \cdot y\right) \cdot -4 - x \cdot x}{x}}\right) - \color{blue}{\left(-y\right) \cdot \frac{1}{\left(y \cdot \left(y \cdot -4\right) - x \cdot x\right) \cdot \left(-\frac{-0.25}{y}\right)}} \]
    6. Simplified0.3

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

      [Start]16.5

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

      associate-*r/ [=>]16.4

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

      *-rgt-identity [=>]16.4

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

      distribute-neg-frac [=>]16.4

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

      metadata-eval [=>]16.4

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

      metadata-eval [<=]16.4

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

      associate-/r* [<=]16.4

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

      *-commutative [<=]16.4

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

      associate-*r/ [=>]16.4

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

      *-rgt-identity [=>]16.4

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

      div-sub [=>]16.4

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

      associate-*r* [=>]16.4

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

      times-frac [=>]16.4

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

      associate-/l* [=>]0.3

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

      *-inverses [=>]0.3

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

      /-rgt-identity [=>]0.3

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

      metadata-eval [=>]0.3

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

      *-commutative [<=]0.3

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

      neg-mul-1 [<=]0.3

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

      times-frac [=>]0.3

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

    if -2.30000000000000002e-116 < x < 6.99999999999999988e-171

    1. Initial program 29.3

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

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

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

      [Start]16.0

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

      fma-neg [=>]16.0

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

      unpow2 [=>]16.0

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

      unpow2 [=>]16.0

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

      associate-/r* [=>]9.3

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

      metadata-eval [=>]9.3

      \[ \mathsf{fma}\left(0.5, \frac{\frac{x \cdot x}{y}}{y}, \color{blue}{-1}\right) \]
    4. Applied egg-rr8.7

      \[\leadsto \mathsf{fma}\left(0.5, \color{blue}{e^{\log \left({\left(\frac{x}{y}\right)}^{2}\right)}}, -1\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification4.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;1 + \left(y \cdot \frac{\frac{y}{x}}{x}\right) \cdot -8\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-116}:\\ \;\;\;\;\frac{y}{\left(-y\right) - \frac{x}{y} \cdot \frac{x}{4}} - \frac{x}{\frac{\left(y \cdot y\right) \cdot -4 - x \cdot x}{x}}\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-171}:\\ \;\;\;\;\mathsf{fma}\left(0.5, e^{\log \left({\left(\frac{x}{y}\right)}^{2}\right)}, -1\right)\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{+152}:\\ \;\;\;\;\frac{y}{\left(-y\right) - \frac{x}{y} \cdot \frac{x}{4}} - \frac{x}{\frac{\left(y \cdot y\right) \cdot -4 - x \cdot x}{x}}\\ \mathbf{else}:\\ \;\;\;\;1 + \left(y \cdot \frac{\frac{y}{x}}{x}\right) \cdot -8\\ \end{array} \]

Alternatives

Alternative 1
Error4.6
Cost7372
\[\begin{array}{l} t_0 := \frac{y}{\left(-y\right) - \frac{x}{y} \cdot \frac{x}{4}} - \frac{x}{\frac{\left(y \cdot y\right) \cdot -4 - x \cdot x}{x}}\\ t_1 := 1 + \left(y \cdot \frac{\frac{y}{x}}{x}\right) \cdot -8\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-116}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-171}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{x \cdot \frac{x}{y}}{y}, -1\right)\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{+152}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error12.7
Cost2896
\[\begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := y \cdot \left(y \cdot -4\right)\\ t_2 := 1 + \left(y \cdot \frac{\frac{y}{x}}{x}\right) \cdot -8\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_0 \leq 10^{+164}:\\ \;\;\;\;\frac{x \cdot x + t_1}{x \cdot x + t_0}\\ \mathbf{elif}\;t_0 \leq 3 \cdot 10^{+205}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+226}:\\ \;\;\;\;\frac{1}{t_1 - x \cdot x} \cdot \left(t_0 - x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y \cdot 4}\\ \end{array} \]
Alternative 3
Error12.7
Cost2768
\[\begin{array}{l} t_0 := 1 + \left(y \cdot \frac{\frac{y}{x}}{x}\right) \cdot -8\\ t_1 := y \cdot \left(y \cdot 4\right)\\ t_2 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{x \cdot x + t_1}\\ \mathbf{if}\;t_1 \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_1 \leq 10^{+164}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 3 \cdot 10^{+205}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+226}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y \cdot 4}\\ \end{array} \]
Alternative 4
Error16.4
Cost2645
\[\begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := 1 + \left(y \cdot \frac{\frac{y}{x}}{x}\right) \cdot -8\\ \mathbf{if}\;t_0 \leq 10^{-74}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{-28}:\\ \;\;\;\;-1\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+16} \lor \neg \left(t_0 \leq 10^{+164}\right) \land t_0 \leq 3 \cdot 10^{+205}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y \cdot 4}\\ \end{array} \]
Alternative 5
Error4.7
Cost2192
\[\begin{array}{l} t_0 := \frac{y}{\left(-y\right) - \frac{x}{y} \cdot \frac{x}{4}} - \frac{x}{\frac{\left(y \cdot y\right) \cdot -4 - x \cdot x}{x}}\\ t_1 := 1 + \left(y \cdot \frac{\frac{y}{x}}{x}\right) \cdot -8\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-116}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-171}:\\ \;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y \cdot 4}\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{+152}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error16.6
Cost1232
\[\begin{array}{l} t_0 := 1 + \left(y \cdot \frac{\frac{y}{x}}{x}\right) \cdot -8\\ \mathbf{if}\;x \leq -7.5 \cdot 10^{-23}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{-108}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{-91}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{+17}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error17.7
Cost856
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{+125}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{+76}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq -2.35 \cdot 10^{-23}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{-107}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-92}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 4.8 \cdot 10^{+16}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 8
Error31.5
Cost64
\[-1 \]

Error

Reproduce?

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