Average Error: 31.2 → 14.0
Time: 7.7s
Precision: binary64
Cost: 47256
\[\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 + t_0\\ t_2 := \frac{x \cdot x - t_0}{t_1}\\ t_3 := \frac{x}{y} \cdot \frac{x}{y}\\ t_4 := \mathsf{fma}\left(0.5, t_3, -1\right)\\ \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot -4\right)\right)}{t_1}\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\ \;\;\;\;\mathsf{fma}\left(0.25, t_3, -1\right)\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{y}{x}\right)}\right)}^{4}, \sqrt[3]{1 + {\left(\frac{y}{x}\right)}^{2}}, -1\right), -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) t_0))
        (t_2 (/ (- (* x x) t_0) t_1))
        (t_3 (* (/ x y) (/ x y)))
        (t_4 (fma 0.5 t_3 -1.0)))
   (if (<= (* x x) 2e-294)
     t_4
     (if (<= (* x x) 2e-205)
       t_2
       (if (<= (* x x) 4e-23)
         t_4
         (if (<= (* x x) 5e+164)
           (/ (fma x x (* y (* y -4.0))) t_1)
           (if (<= (* x x) 2e+192)
             (fma 0.25 t_3 -1.0)
             (if (<= (* x x) 2e+218)
               t_2
               (fma
                (fma
                 (pow (cbrt (hypot 1.0 (/ y x))) 4.0)
                 (cbrt (+ 1.0 (pow (/ y x) 2.0)))
                 -1.0)
                -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) + t_0;
	double t_2 = ((x * x) - t_0) / t_1;
	double t_3 = (x / y) * (x / y);
	double t_4 = fma(0.5, t_3, -1.0);
	double tmp;
	if ((x * x) <= 2e-294) {
		tmp = t_4;
	} else if ((x * x) <= 2e-205) {
		tmp = t_2;
	} else if ((x * x) <= 4e-23) {
		tmp = t_4;
	} else if ((x * x) <= 5e+164) {
		tmp = fma(x, x, (y * (y * -4.0))) / t_1;
	} else if ((x * x) <= 2e+192) {
		tmp = fma(0.25, t_3, -1.0);
	} else if ((x * x) <= 2e+218) {
		tmp = t_2;
	} else {
		tmp = fma(fma(pow(cbrt(hypot(1.0, (y / x))), 4.0), cbrt((1.0 + pow((y / x), 2.0))), -1.0), -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) + t_0)
	t_2 = Float64(Float64(Float64(x * x) - t_0) / t_1)
	t_3 = Float64(Float64(x / y) * Float64(x / y))
	t_4 = fma(0.5, t_3, -1.0)
	tmp = 0.0
	if (Float64(x * x) <= 2e-294)
		tmp = t_4;
	elseif (Float64(x * x) <= 2e-205)
		tmp = t_2;
	elseif (Float64(x * x) <= 4e-23)
		tmp = t_4;
	elseif (Float64(x * x) <= 5e+164)
		tmp = Float64(fma(x, x, Float64(y * Float64(y * -4.0))) / t_1);
	elseif (Float64(x * x) <= 2e+192)
		tmp = fma(0.25, t_3, -1.0);
	elseif (Float64(x * x) <= 2e+218)
		tmp = t_2;
	else
		tmp = fma(fma((cbrt(hypot(1.0, Float64(y / x))) ^ 4.0), cbrt(Float64(1.0 + (Float64(y / x) ^ 2.0))), -1.0), -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] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(0.5 * t$95$3 + -1.0), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 2e-294], t$95$4, If[LessEqual[N[(x * x), $MachinePrecision], 2e-205], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 4e-23], t$95$4, If[LessEqual[N[(x * x), $MachinePrecision], 5e+164], N[(N[(x * x + N[(y * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 2e+192], N[(0.25 * t$95$3 + -1.0), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 2e+218], t$95$2, N[(N[(N[Power[N[Power[N[Sqrt[1.0 ^ 2 + N[(y / x), $MachinePrecision] ^ 2], $MachinePrecision], 1/3], $MachinePrecision], 4.0], $MachinePrecision] * N[Power[N[(1.0 + N[Power[N[(y / x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + -1.0), $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 + t_0\\
t_2 := \frac{x \cdot x - t_0}{t_1}\\
t_3 := \frac{x}{y} \cdot \frac{x}{y}\\
t_4 := \mathsf{fma}\left(0.5, t_3, -1\right)\\
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\
\;\;\;\;t_4\\

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

\mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot -4\right)\right)}{t_1}\\

\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\
\;\;\;\;\mathsf{fma}\left(0.25, t_3, -1\right)\\

\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left({\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{y}{x}\right)}\right)}^{4}, \sqrt[3]{1 + {\left(\frac{y}{x}\right)}^{2}}, -1\right), -8, 1\right)\\


\end{array}

Error

Target

Original31.2
Target30.9
Herbie14.0
\[\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 x x) < 2.00000000000000003e-294 or 2e-205 < (*.f64 x x) < 3.99999999999999984e-23

    1. Initial program 24.2

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot -4\right)\right)}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)}} \]
      Proof
      (/.f64 (fma.f64 x x (*.f64 y (*.f64 y -4))) (fma.f64 x x (*.f64 y (*.f64 y 4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 x x (*.f64 y (*.f64 y (Rewrite<= metadata-eval (neg.f64 4))))) (fma.f64 x x (*.f64 y (*.f64 y 4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 x x (*.f64 y (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 y 4))))) (fma.f64 x x (*.f64 y (*.f64 y 4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 x x (Rewrite<= *-commutative_binary64 (*.f64 (neg.f64 (*.f64 y 4)) y))) (fma.f64 x x (*.f64 y (*.f64 y 4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (fma.f64 x x (Rewrite=> distribute-lft-neg-out_binary64 (neg.f64 (*.f64 (*.f64 y 4) y)))) (fma.f64 x x (*.f64 y (*.f64 y 4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y))) (fma.f64 x x (*.f64 y (*.f64 y 4)))): 1 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (Rewrite<= +-rgt-identity_binary64 (+.f64 (*.f64 x x) 0)) (*.f64 (*.f64 y 4) y)) (fma.f64 x x (*.f64 y (*.f64 y 4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (+.f64 (*.f64 x x) 0) (*.f64 (*.f64 y 4) y)) (fma.f64 x x (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 y 4) y)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (+.f64 (*.f64 x x) 0) (*.f64 (*.f64 y 4) y)) (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> div-sub_binary64 (-.f64 (/.f64 (+.f64 (*.f64 x x) 0) (+.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y))) (/.f64 (*.f64 (*.f64 y 4) y) (+.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y))))): 0 points increase in error, 2 points decrease in error
      (-.f64 (/.f64 (Rewrite=> +-rgt-identity_binary64 (*.f64 x x)) (+.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y))) (/.f64 (*.f64 (*.f64 y 4) y) (+.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= div-sub_binary64 (/.f64 (-.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y)) (+.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y)))): 2 points increase in error, 0 points decrease in error
    3. Taylor expanded in x around 0 18.9

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)} \]
      Proof
      (fma.f64 1/2 (*.f64 (/.f64 x y) (/.f64 x y)) -1): 0 points increase in error, 0 points decrease in error
      (fma.f64 1/2 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 x x) (*.f64 y y))) -1): 50 points increase in error, 5 points decrease in error
      (fma.f64 1/2 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 x 2)) (*.f64 y y)) -1): 0 points increase in error, 0 points decrease in error
      (fma.f64 1/2 (/.f64 (pow.f64 x 2) (Rewrite<= unpow2_binary64 (pow.f64 y 2))) -1): 0 points increase in error, 1 points decrease in error
      (fma.f64 1/2 (/.f64 (pow.f64 x 2) (pow.f64 y 2)) (Rewrite<= metadata-eval (neg.f64 1))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 1/2 (/.f64 (pow.f64 x 2) (pow.f64 y 2))) 1)): 0 points increase in error, 0 points decrease in error

    if 2.00000000000000003e-294 < (*.f64 x x) < 2e-205 or 2.00000000000000008e192 < (*.f64 x x) < 2.00000000000000017e218

    1. Initial program 14.6

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

    if 3.99999999999999984e-23 < (*.f64 x x) < 4.9999999999999995e164

    1. Initial program 16.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 16.4

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

      \[\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
      (fma.f64 x x (*.f64 y (*.f64 y -4))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> fma-udef_binary64 (+.f64 (*.f64 x x) (*.f64 y (*.f64 y -4)))): 1 points increase in error, 0 points decrease in error
      (Rewrite=> +-commutative_binary64 (+.f64 (*.f64 y (*.f64 y -4)) (*.f64 x x))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite=> associate-*r*_binary64 (*.f64 (*.f64 y y) -4)) (*.f64 x x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 y 2)) -4) (*.f64 x x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 -4 (pow.f64 y 2))) (*.f64 x x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 -4 (pow.f64 y 2)) (Rewrite<= unpow2_binary64 (pow.f64 x 2))): 0 points increase in error, 0 points decrease in error

    if 4.9999999999999995e164 < (*.f64 x x) < 2.00000000000000008e192

    1. Initial program 16.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 0 56.6

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

      \[\leadsto \frac{\color{blue}{y \cdot \left(y \cdot -4\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      Proof
      (*.f64 y (*.f64 y -4)): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*r*_binary64 (*.f64 (*.f64 y y) -4)): 1 points increase in error, 1 points decrease in error
      (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 y 2)) -4): 1 points increase in error, 0 points decrease in error
      (Rewrite<= *-commutative_binary64 (*.f64 -4 (pow.f64 y 2))): 0 points increase in error, 0 points decrease in error
    4. Taylor expanded in y around inf 40.9

      \[\leadsto \color{blue}{0.25 \cdot \frac{{x}^{2}}{{y}^{2}} - 1} \]
    5. Simplified40.9

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.25, \frac{x}{y} \cdot \frac{x}{y}, -1\right)} \]
      Proof
      (fma.f64 1/4 (*.f64 (/.f64 x y) (/.f64 x y)) -1): 0 points increase in error, 0 points decrease in error
      (fma.f64 1/4 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 x x) (*.f64 y y))) -1): 50 points increase in error, 5 points decrease in error
      (fma.f64 1/4 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 x 2)) (*.f64 y y)) -1): 0 points increase in error, 0 points decrease in error
      (fma.f64 1/4 (/.f64 (pow.f64 x 2) (Rewrite<= unpow2_binary64 (pow.f64 y 2))) -1): 0 points increase in error, 1 points decrease in error
      (fma.f64 1/4 (/.f64 (pow.f64 x 2) (pow.f64 y 2)) (Rewrite<= metadata-eval (neg.f64 1))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 1/4 (/.f64 (pow.f64 x 2) (pow.f64 y 2))) 1)): 0 points increase in error, 0 points decrease in error

    if 2.00000000000000017e218 < (*.f64 x x)

    1. Initial program 52.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.0

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

      \[\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): 67 points increase in error, 5 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, 1 points decrease in error
    4. Applied egg-rr10.6

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

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

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{0 + {\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{y}{x}\right)}\right)}^{4}}, \sqrt[3]{1 + {\left(\frac{y}{x}\right)}^{2}}, -1\right), -8, 1\right) \]
    7. Simplified10.6

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{{\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{y}{x}\right)}\right)}^{4}}, \sqrt[3]{1 + {\left(\frac{y}{x}\right)}^{2}}, -1\right), -8, 1\right) \]
      Proof
      (pow.f64 (cbrt.f64 (hypot.f64 1 (/.f64 y x))) 4): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-lft-identity_binary64 (+.f64 0 (pow.f64 (cbrt.f64 (hypot.f64 1 (/.f64 y x))) 4))): 0 points increase in error, 0 points decrease in error
  3. Recombined 5 regimes into one program.
  4. Final simplification14.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\ \;\;\;\;\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 4 \cdot 10^{-23}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\ \;\;\;\;\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 2 \cdot 10^{+192}:\\ \;\;\;\;\mathsf{fma}\left(0.25, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\ \;\;\;\;\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(\mathsf{fma}\left({\left(\sqrt[3]{\mathsf{hypot}\left(1, \frac{y}{x}\right)}\right)}^{4}, \sqrt[3]{1 + {\left(\frac{y}{x}\right)}^{2}}, -1\right), -8, 1\right)\\ \end{array} \]

Alternatives

Alternative 1
Error14.0
Cost15000
\[\begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := x \cdot x + t_0\\ t_2 := \frac{x \cdot x - t_0}{t_1}\\ t_3 := \frac{x}{y} \cdot \frac{x}{y}\\ t_4 := \mathsf{fma}\left(0.5, t_3, -1\right)\\ \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot -4\right)\right)}{t_1}\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\ \;\;\;\;\mathsf{fma}\left(0.25, t_3, -1\right)\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-1 + \left(1 + {\left(\frac{y}{x}\right)}^{2}\right), -8, 1\right)\\ \end{array} \]
Alternative 2
Error14.0
Cost8536
\[\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 := \frac{x}{y} \cdot \frac{x}{y}\\ t_3 := \mathsf{fma}\left(0.5, t_2, -1\right)\\ \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\ \;\;\;\;\mathsf{fma}\left(0.25, t_2, -1\right)\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\ \end{array} \]
Alternative 3
Error14.0
Cost8536
\[\begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := x \cdot x + t_0\\ t_2 := \frac{x \cdot x - t_0}{t_1}\\ t_3 := \frac{x}{y} \cdot \frac{x}{y}\\ t_4 := \mathsf{fma}\left(0.5, t_3, -1\right)\\ \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot -4\right)\right)}{t_1}\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\ \;\;\;\;\mathsf{fma}\left(0.25, t_3, -1\right)\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)\\ \end{array} \]
Alternative 4
Error14.1
Cost8276
\[\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 := \frac{x}{y} \cdot \frac{x}{y}\\ t_3 := \mathsf{fma}\left(0.5, t_2, -1\right)\\ \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\ \;\;\;\;\mathsf{fma}\left(0.25, t_2, -1\right)\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-4 \cdot \frac{y}{\frac{x}{y}}}{x}\\ \end{array} \]
Alternative 5
Error12.2
Cost7504
\[\begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := \mathsf{fma}\left(0.25, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ t_2 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\ \mathbf{if}\;y \leq -4.5 \cdot 10^{+81}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.1 \cdot 10^{-154}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{-162}:\\ \;\;\;\;1 + \frac{-4 \cdot \frac{y}{\frac{x}{y}}}{x}\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+33}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error14.3
Cost2776
\[\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}\\ \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-294}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-205}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 4 \cdot 10^{-23}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+218}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{-4 \cdot \frac{y}{\frac{x}{y}}}{x}\\ \end{array} \]
Alternative 7
Error16.9
Cost1484
\[\begin{array}{l} t_0 := 1 + \frac{-4 \cdot \frac{y}{\frac{x}{y}}}{x}\\ \mathbf{if}\;x \cdot x \leq 4 \cdot 10^{-23}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+164}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error17.0
Cost1224
\[\begin{array}{l} \mathbf{if}\;x \cdot x \leq 4.8 \cdot 10^{-23}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 2.5 \cdot 10^{+165}:\\ \;\;\;\;1 + -4 \cdot \frac{y \cdot y}{x \cdot x}\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+192}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 9
Error16.7
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{-31}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{+41}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 10
Error31.7
Cost64
\[-1 \]

Error

Reproduce

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