?

Average Error: 50.02% → 20.94%
Time: 8.5s
Precision: binary64
Cost: 8536

?

\[\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)\\ t_2 := \frac{x \cdot x + t_0}{t_1}\\ t_3 := \mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-285}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-244}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-86}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \cdot x \leq 10^{+124}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, x, t_0\right)}{t_1}\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+139}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+184}:\\ \;\;\;\;t_2\\ \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 (+ (* x x) (* y (* y 4.0))))
        (t_2 (/ (+ (* x x) t_0) t_1))
        (t_3 (fma 0.5 (* (/ x y) (/ x y)) -1.0)))
   (if (<= (* x x) 5e-285)
     t_3
     (if (<= (* x x) 5e-244)
       t_2
       (if (<= (* x x) 5e-86)
         t_3
         (if (<= (* x x) 1e+124)
           (/ (fma x x t_0) t_1)
           (if (<= (* x x) 4e+139)
             t_3
             (if (<= (* x x) 5e+184)
               t_2
               (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 = (x * x) + (y * (y * 4.0));
	double t_2 = ((x * x) + t_0) / t_1;
	double t_3 = fma(0.5, ((x / y) * (x / y)), -1.0);
	double tmp;
	if ((x * x) <= 5e-285) {
		tmp = t_3;
	} else if ((x * x) <= 5e-244) {
		tmp = t_2;
	} else if ((x * x) <= 5e-86) {
		tmp = t_3;
	} else if ((x * x) <= 1e+124) {
		tmp = fma(x, x, t_0) / t_1;
	} else if ((x * x) <= 4e+139) {
		tmp = t_3;
	} else if ((x * x) <= 5e+184) {
		tmp = t_2;
	} 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(Float64(x * x) + Float64(y * Float64(y * 4.0)))
	t_2 = Float64(Float64(Float64(x * x) + t_0) / t_1)
	t_3 = fma(0.5, Float64(Float64(x / y) * Float64(x / y)), -1.0)
	tmp = 0.0
	if (Float64(x * x) <= 5e-285)
		tmp = t_3;
	elseif (Float64(x * x) <= 5e-244)
		tmp = t_2;
	elseif (Float64(x * x) <= 5e-86)
		tmp = t_3;
	elseif (Float64(x * x) <= 1e+124)
		tmp = Float64(fma(x, x, t_0) / t_1);
	elseif (Float64(x * x) <= 4e+139)
		tmp = t_3;
	elseif (Float64(x * x) <= 5e+184)
		tmp = t_2;
	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[(N[(x * x), $MachinePrecision] + N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(0.5 * N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e-285], t$95$3, If[LessEqual[N[(x * x), $MachinePrecision], 5e-244], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 5e-86], t$95$3, If[LessEqual[N[(x * x), $MachinePrecision], 1e+124], N[(N[(x * x + t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 4e+139], t$95$3, If[LessEqual[N[(x * x), $MachinePrecision], 5e+184], t$95$2, 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 := x \cdot x + y \cdot \left(y \cdot 4\right)\\
t_2 := \frac{x \cdot x + t_0}{t_1}\\
t_3 := \mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-285}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-244}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-86}:\\
\;\;\;\;t_3\\

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

\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+139}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+184}:\\
\;\;\;\;t_2\\

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


\end{array}

Error?

Target

Original50.02%
Target49.54%
Herbie20.94%
\[\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) < 5.00000000000000018e-285 or 4.99999999999999998e-244 < (*.f64 x x) < 4.9999999999999999e-86 or 9.99999999999999948e123 < (*.f64 x x) < 4.00000000000000013e139

    1. Initial program 38.8

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

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

      [Start]38.8

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

      fma-neg [=>]38.79

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

      *-commutative [=>]38.79

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

      associate-*r* [=>]39.01

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

      distribute-rgt-neg-in [=>]39.01

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

      metadata-eval [=>]39.01

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

      fma-def [=>]39.01

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

      *-commutative [=>]39.01

      \[ \frac{\mathsf{fma}\left(x, x, \left(y \cdot y\right) \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 29.18

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

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

      [Start]29.18

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

      fma-neg [=>]29.18

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

      unpow2 [=>]29.18

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

      unpow2 [=>]29.18

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

      times-frac [=>]21.26

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

      metadata-eval [=>]21.26

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

    if 5.00000000000000018e-285 < (*.f64 x x) < 4.99999999999999998e-244 or 4.00000000000000013e139 < (*.f64 x x) < 4.9999999999999999e184

    1. Initial program 27.86

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

    if 4.9999999999999999e-86 < (*.f64 x x) < 9.99999999999999948e123

    1. Initial program 25.85

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

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

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

      [Start]25.85

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

      unpow2 [=>]25.85

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

      *-commutative [=>]25.85

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

      unpow2 [=>]25.85

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

      associate-*r* [<=]25.85

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

      +-commutative [<=]25.85

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

      fma-def [=>]25.85

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

    if 4.9999999999999999e184 < (*.f64 x x)

    1. Initial program 79.35

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

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

      [Start]79.35

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

      fma-neg [=>]79.35

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

      *-commutative [=>]79.35

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

      associate-*r* [=>]79.35

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

      distribute-rgt-neg-in [=>]79.35

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

      metadata-eval [=>]79.35

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

      fma-def [=>]79.35

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

      *-commutative [=>]79.35

      \[ \frac{\mathsf{fma}\left(x, x, \left(y \cdot y\right) \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 25.96

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

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

      [Start]25.96

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

      associate--l+ [=>]25.95

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

      +-commutative [=>]25.95

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

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

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

      metadata-eval [=>]25.95

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

      fma-def [=>]25.95

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

      unpow2 [=>]25.95

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

      unpow2 [=>]25.95

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

      times-frac [=>]16.85

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

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

Alternatives

Alternative 1
Error20.94%
Cost8536
\[\begin{array}{l} t_0 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ t_1 := \mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-285}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-244}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-86}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 10^{+124}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+139}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+184}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\ \end{array} \]
Alternative 2
Error21.01%
Cost8276
\[\begin{array}{l} t_0 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ t_1 := \mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-285}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-244}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-86}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 10^{+124}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+139}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+184}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{y}{x} \cdot \frac{y \cdot 4}{x}\\ \end{array} \]
Alternative 3
Error21.44%
Cost2776
\[\begin{array}{l} t_0 := \frac{x \cdot x + y \cdot \left(y \cdot -4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-285}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-244}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-86}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 10^{+124}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{+139}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+184}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{y}{x} \cdot \frac{y \cdot 4}{x}\\ \end{array} \]
Alternative 4
Error25.62%
Cost1234
\[\begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{-42} \lor \neg \left(x \leq 4.5 \cdot 10^{-61}\right) \land \left(x \leq 4800 \lor \neg \left(x \leq 7.5 \cdot 10^{+31}\right)\right):\\ \;\;\;\;1 - \frac{y}{x} \cdot \frac{y \cdot 4}{x}\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 5
Error25.97%
Cost592
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{-36}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-61}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-7}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+34}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 6
Error49.51%
Cost64
\[-1 \]

Error

Reproduce?

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