Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3

Percentage Accurate: 50.3% → 80.1%
Time: 6.6s
Alternatives: 6
Speedup: 19.0×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y \cdot 4\right) \cdot y\\ \frac{x \cdot x - t_0}{x \cdot x + t_0} \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (* y 4.0) y))) (/ (- (* x x) t_0) (+ (* x x) t_0))))
double code(double x, double y) {
	double t_0 = (y * 4.0) * y;
	return ((x * x) - t_0) / ((x * x) + t_0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    t_0 = (y * 4.0d0) * y
    code = ((x * x) - t_0) / ((x * x) + t_0)
end function
public static double code(double x, double y) {
	double t_0 = (y * 4.0) * y;
	return ((x * x) - t_0) / ((x * x) + t_0);
}
def code(x, y):
	t_0 = (y * 4.0) * y
	return ((x * x) - t_0) / ((x * x) + t_0)
function code(x, y)
	t_0 = Float64(Float64(y * 4.0) * y)
	return Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0))
end
function tmp = code(x, y)
	t_0 = (y * 4.0) * y;
	tmp = ((x * x) - t_0) / ((x * x) + t_0);
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]}, N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(y \cdot 4\right) \cdot y\\
\frac{x \cdot x - t_0}{x \cdot x + t_0}
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 50.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y \cdot 4\right) \cdot y\\ \frac{x \cdot x - t_0}{x \cdot x + t_0} \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (* y 4.0) y))) (/ (- (* x x) t_0) (+ (* x x) t_0))))
double code(double x, double y) {
	double t_0 = (y * 4.0) * y;
	return ((x * x) - t_0) / ((x * x) + t_0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    t_0 = (y * 4.0d0) * y
    code = ((x * x) - t_0) / ((x * x) + t_0)
end function
public static double code(double x, double y) {
	double t_0 = (y * 4.0) * y;
	return ((x * x) - t_0) / ((x * x) + t_0);
}
def code(x, y):
	t_0 = (y * 4.0) * y
	return ((x * x) - t_0) / ((x * x) + t_0)
function code(x, y)
	t_0 = Float64(Float64(y * 4.0) * y)
	return Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0))
end
function tmp = code(x, y)
	t_0 = (y * 4.0) * y;
	tmp = ((x * x) - t_0) / ((x * x) + t_0);
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]}, N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(y \cdot 4\right) \cdot y\\
\frac{x \cdot x - t_0}{x \cdot x + t_0}
\end{array}
\end{array}

Alternative 1: 80.1% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\ t_1 := y \cdot \left(y \cdot 4\right)\\ t_2 := \frac{x \cdot x - t_1}{t_1 + x \cdot x}\\ \mathbf{if}\;t_1 \leq 2 \cdot 10^{-296}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_1 \leq 10^{-134}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 10^{-65}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+223}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot {\left(\frac{x}{y}\right)}^{2} + -1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- 1.0 (* (* y (/ y x)) (/ 8.0 x))))
        (t_1 (* y (* y 4.0)))
        (t_2 (/ (- (* x x) t_1) (+ t_1 (* x x)))))
   (if (<= t_1 2e-296)
     t_0
     (if (<= t_1 1e-134)
       t_2
       (if (<= t_1 1e-65)
         t_0
         (if (<= t_1 2e+223) t_2 (+ (* 0.5 (pow (/ x y) 2.0)) -1.0)))))))
double code(double x, double y) {
	double t_0 = 1.0 - ((y * (y / x)) * (8.0 / x));
	double t_1 = y * (y * 4.0);
	double t_2 = ((x * x) - t_1) / (t_1 + (x * x));
	double tmp;
	if (t_1 <= 2e-296) {
		tmp = t_0;
	} else if (t_1 <= 1e-134) {
		tmp = t_2;
	} else if (t_1 <= 1e-65) {
		tmp = t_0;
	} else if (t_1 <= 2e+223) {
		tmp = t_2;
	} else {
		tmp = (0.5 * pow((x / y), 2.0)) + -1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = 1.0d0 - ((y * (y / x)) * (8.0d0 / x))
    t_1 = y * (y * 4.0d0)
    t_2 = ((x * x) - t_1) / (t_1 + (x * x))
    if (t_1 <= 2d-296) then
        tmp = t_0
    else if (t_1 <= 1d-134) then
        tmp = t_2
    else if (t_1 <= 1d-65) then
        tmp = t_0
    else if (t_1 <= 2d+223) then
        tmp = t_2
    else
        tmp = (0.5d0 * ((x / y) ** 2.0d0)) + (-1.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 1.0 - ((y * (y / x)) * (8.0 / x));
	double t_1 = y * (y * 4.0);
	double t_2 = ((x * x) - t_1) / (t_1 + (x * x));
	double tmp;
	if (t_1 <= 2e-296) {
		tmp = t_0;
	} else if (t_1 <= 1e-134) {
		tmp = t_2;
	} else if (t_1 <= 1e-65) {
		tmp = t_0;
	} else if (t_1 <= 2e+223) {
		tmp = t_2;
	} else {
		tmp = (0.5 * Math.pow((x / y), 2.0)) + -1.0;
	}
	return tmp;
}
def code(x, y):
	t_0 = 1.0 - ((y * (y / x)) * (8.0 / x))
	t_1 = y * (y * 4.0)
	t_2 = ((x * x) - t_1) / (t_1 + (x * x))
	tmp = 0
	if t_1 <= 2e-296:
		tmp = t_0
	elif t_1 <= 1e-134:
		tmp = t_2
	elif t_1 <= 1e-65:
		tmp = t_0
	elif t_1 <= 2e+223:
		tmp = t_2
	else:
		tmp = (0.5 * math.pow((x / y), 2.0)) + -1.0
	return tmp
function code(x, y)
	t_0 = Float64(1.0 - Float64(Float64(y * Float64(y / x)) * Float64(8.0 / x)))
	t_1 = Float64(y * Float64(y * 4.0))
	t_2 = Float64(Float64(Float64(x * x) - t_1) / Float64(t_1 + Float64(x * x)))
	tmp = 0.0
	if (t_1 <= 2e-296)
		tmp = t_0;
	elseif (t_1 <= 1e-134)
		tmp = t_2;
	elseif (t_1 <= 1e-65)
		tmp = t_0;
	elseif (t_1 <= 2e+223)
		tmp = t_2;
	else
		tmp = Float64(Float64(0.5 * (Float64(x / y) ^ 2.0)) + -1.0);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 1.0 - ((y * (y / x)) * (8.0 / x));
	t_1 = y * (y * 4.0);
	t_2 = ((x * x) - t_1) / (t_1 + (x * x));
	tmp = 0.0;
	if (t_1 <= 2e-296)
		tmp = t_0;
	elseif (t_1 <= 1e-134)
		tmp = t_2;
	elseif (t_1 <= 1e-65)
		tmp = t_0;
	elseif (t_1 <= 2e+223)
		tmp = t_2;
	else
		tmp = (0.5 * ((x / y) ^ 2.0)) + -1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(N[(y * N[(y / x), $MachinePrecision]), $MachinePrecision] * N[(8.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * x), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(t$95$1 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-296], t$95$0, If[LessEqual[t$95$1, 1e-134], t$95$2, If[LessEqual[t$95$1, 1e-65], t$95$0, If[LessEqual[t$95$1, 2e+223], t$95$2, N[(N[(0.5 * N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\
t_1 := y \cdot \left(y \cdot 4\right)\\
t_2 := \frac{x \cdot x - t_1}{t_1 + x \cdot x}\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{-296}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;t_1 \leq 10^{-134}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+223}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot {\left(\frac{x}{y}\right)}^{2} + -1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y 4) y) < 2e-296 or 1.00000000000000004e-134 < (*.f64 (*.f64 y 4) y) < 9.99999999999999923e-66

    1. Initial program 57.5%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Step-by-step derivation
      1. frac-2neg57.5%

        \[\leadsto \color{blue}{\frac{-\left(x \cdot x - \left(y \cdot 4\right) \cdot y\right)}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)}} \]
      2. div-inv57.4%

        \[\leadsto \color{blue}{\left(-\left(x \cdot x - \left(y \cdot 4\right) \cdot y\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)}} \]
      3. sub-neg57.4%

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

        \[\leadsto \left(-\color{blue}{\left(\left(-\left(y \cdot 4\right) \cdot y\right) + x \cdot x\right)}\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      5. *-commutative57.4%

        \[\leadsto \left(-\left(\left(-\color{blue}{y \cdot \left(y \cdot 4\right)}\right) + x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      6. distribute-rgt-neg-in57.4%

        \[\leadsto \left(-\left(\color{blue}{y \cdot \left(-y \cdot 4\right)} + x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      7. fma-def57.4%

        \[\leadsto \left(-\color{blue}{\mathsf{fma}\left(y, -y \cdot 4, x \cdot x\right)}\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      8. distribute-rgt-neg-in57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, \color{blue}{y \cdot \left(-4\right)}, x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      9. metadata-eval57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot \color{blue}{-4}, x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      10. +-commutative57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{-\color{blue}{\left(\left(y \cdot 4\right) \cdot y + x \cdot x\right)}} \]
      11. distribute-neg-in57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{\left(-\left(y \cdot 4\right) \cdot y\right) + \left(-x \cdot x\right)}} \]
      12. *-commutative57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\left(-\color{blue}{y \cdot \left(y \cdot 4\right)}\right) + \left(-x \cdot x\right)} \]
      13. distribute-rgt-neg-in57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{y \cdot \left(-y \cdot 4\right)} + \left(-x \cdot x\right)} \]
      14. fma-def57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{\mathsf{fma}\left(y, -y \cdot 4, -x \cdot x\right)}} \]
      15. distribute-rgt-neg-in57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, \color{blue}{y \cdot \left(-4\right)}, -x \cdot x\right)} \]
      16. metadata-eval57.4%

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

      \[\leadsto \color{blue}{\left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, -x \cdot x\right)}} \]
    4. Step-by-step derivation
      1. distribute-rgt-neg-in57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, \color{blue}{x \cdot \left(-x\right)}\right)} \]
    5. Simplified57.4%

      \[\leadsto \color{blue}{\left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, x \cdot \left(-x\right)\right)}} \]
    6. Step-by-step derivation
      1. fma-udef57.4%

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

      \[\leadsto \left(-\color{blue}{\left(y \cdot \left(y \cdot -4\right) + x \cdot x\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, x \cdot \left(-x\right)\right)} \]
    8. Taylor expanded in x around inf 82.5%

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{{x}^{2}}} \]
    9. Step-by-step derivation
      1. mul-1-neg82.5%

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

        \[\leadsto \color{blue}{1 - \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{{x}^{2}}} \]
      3. unpow282.5%

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

        \[\leadsto 1 - \frac{4 \cdot \color{blue}{\left(y \cdot y\right)} - -4 \cdot \left(y \cdot y\right)}{{x}^{2}} \]
      5. distribute-rgt-out--82.5%

        \[\leadsto 1 - \frac{\color{blue}{\left(y \cdot y\right) \cdot \left(4 - -4\right)}}{{x}^{2}} \]
      6. metadata-eval82.5%

        \[\leadsto 1 - \frac{\left(y \cdot y\right) \cdot \color{blue}{8}}{{x}^{2}} \]
      7. unpow282.5%

        \[\leadsto 1 - \frac{\left(y \cdot y\right) \cdot 8}{\color{blue}{x \cdot x}} \]
      8. times-frac90.2%

        \[\leadsto 1 - \color{blue}{\frac{y \cdot y}{x} \cdot \frac{8}{x}} \]
      9. associate-*r/90.7%

        \[\leadsto 1 - \color{blue}{\left(y \cdot \frac{y}{x}\right)} \cdot \frac{8}{x} \]
    10. Simplified90.7%

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

    if 2e-296 < (*.f64 (*.f64 y 4) y) < 1.00000000000000004e-134 or 9.99999999999999923e-66 < (*.f64 (*.f64 y 4) y) < 2.00000000000000009e223

    1. Initial program 81.6%

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

    if 2.00000000000000009e223 < (*.f64 (*.f64 y 4) y)

    1. Initial program 14.1%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Step-by-step derivation
      1. frac-2neg14.1%

        \[\leadsto \color{blue}{\frac{-\left(x \cdot x - \left(y \cdot 4\right) \cdot y\right)}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)}} \]
      2. div-inv14.1%

        \[\leadsto \color{blue}{\left(-\left(x \cdot x - \left(y \cdot 4\right) \cdot y\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)}} \]
      3. sub-neg14.1%

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

        \[\leadsto \left(-\color{blue}{\left(\left(-\left(y \cdot 4\right) \cdot y\right) + x \cdot x\right)}\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      5. *-commutative14.1%

        \[\leadsto \left(-\left(\left(-\color{blue}{y \cdot \left(y \cdot 4\right)}\right) + x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      6. distribute-rgt-neg-in14.1%

        \[\leadsto \left(-\left(\color{blue}{y \cdot \left(-y \cdot 4\right)} + x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      7. fma-def14.1%

        \[\leadsto \left(-\color{blue}{\mathsf{fma}\left(y, -y \cdot 4, x \cdot x\right)}\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      8. distribute-rgt-neg-in14.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, \color{blue}{y \cdot \left(-4\right)}, x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      9. metadata-eval14.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot \color{blue}{-4}, x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      10. +-commutative14.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{-\color{blue}{\left(\left(y \cdot 4\right) \cdot y + x \cdot x\right)}} \]
      11. distribute-neg-in14.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{\left(-\left(y \cdot 4\right) \cdot y\right) + \left(-x \cdot x\right)}} \]
      12. *-commutative14.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\left(-\color{blue}{y \cdot \left(y \cdot 4\right)}\right) + \left(-x \cdot x\right)} \]
      13. distribute-rgt-neg-in14.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{y \cdot \left(-y \cdot 4\right)} + \left(-x \cdot x\right)} \]
      14. fma-def14.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{\mathsf{fma}\left(y, -y \cdot 4, -x \cdot x\right)}} \]
      15. distribute-rgt-neg-in14.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, \color{blue}{y \cdot \left(-4\right)}, -x \cdot x\right)} \]
      16. metadata-eval14.1%

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

      \[\leadsto \color{blue}{\left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, -x \cdot x\right)}} \]
    4. Step-by-step derivation
      1. distribute-rgt-neg-in14.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, \color{blue}{x \cdot \left(-x\right)}\right)} \]
    5. Simplified14.1%

      \[\leadsto \color{blue}{\left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, x \cdot \left(-x\right)\right)}} \]
    6. Taylor expanded in x around 0 62.8%

      \[\leadsto \color{blue}{\left(-0.125 \cdot \frac{{x}^{4}}{{y}^{4}} + 0.5 \cdot \frac{{x}^{2}}{{y}^{2}}\right) - 1} \]
    7. Step-by-step derivation
      1. associate--l+62.8%

        \[\leadsto \color{blue}{-0.125 \cdot \frac{{x}^{4}}{{y}^{4}} + \left(0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right)} \]
      2. fma-def62.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.125, \frac{{x}^{4}}{{y}^{4}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right)} \]
      3. metadata-eval62.8%

        \[\leadsto \mathsf{fma}\left(-0.125, \frac{{x}^{\color{blue}{\left(2 \cdot 2\right)}}}{{y}^{4}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      4. pow-sqr62.8%

        \[\leadsto \mathsf{fma}\left(-0.125, \frac{\color{blue}{{x}^{2} \cdot {x}^{2}}}{{y}^{4}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      5. unpow262.8%

        \[\leadsto \mathsf{fma}\left(-0.125, \frac{\color{blue}{\left(x \cdot x\right)} \cdot {x}^{2}}{{y}^{4}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      6. unpow262.8%

        \[\leadsto \mathsf{fma}\left(-0.125, \frac{\left(x \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)}}{{y}^{4}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      7. metadata-eval62.8%

        \[\leadsto \mathsf{fma}\left(-0.125, \frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}{{y}^{\color{blue}{\left(2 \cdot 2\right)}}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      8. pow-sqr62.8%

        \[\leadsto \mathsf{fma}\left(-0.125, \frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}{\color{blue}{{y}^{2} \cdot {y}^{2}}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      9. times-frac82.1%

        \[\leadsto \mathsf{fma}\left(-0.125, \color{blue}{\frac{x \cdot x}{{y}^{2}} \cdot \frac{x \cdot x}{{y}^{2}}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      10. unpow282.1%

        \[\leadsto \mathsf{fma}\left(-0.125, \frac{x \cdot x}{\color{blue}{y \cdot y}} \cdot \frac{x \cdot x}{{y}^{2}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      11. times-frac82.1%

        \[\leadsto \mathsf{fma}\left(-0.125, \color{blue}{\left(\frac{x}{y} \cdot \frac{x}{y}\right)} \cdot \frac{x \cdot x}{{y}^{2}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      12. unpow282.1%

        \[\leadsto \mathsf{fma}\left(-0.125, \color{blue}{{\left(\frac{x}{y}\right)}^{2}} \cdot \frac{x \cdot x}{{y}^{2}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      13. unpow282.1%

        \[\leadsto \mathsf{fma}\left(-0.125, {\left(\frac{x}{y}\right)}^{2} \cdot \frac{x \cdot x}{\color{blue}{y \cdot y}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      14. times-frac82.1%

        \[\leadsto \mathsf{fma}\left(-0.125, {\left(\frac{x}{y}\right)}^{2} \cdot \color{blue}{\left(\frac{x}{y} \cdot \frac{x}{y}\right)}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      15. unpow282.1%

        \[\leadsto \mathsf{fma}\left(-0.125, {\left(\frac{x}{y}\right)}^{2} \cdot \color{blue}{{\left(\frac{x}{y}\right)}^{2}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      16. pow-sqr82.1%

        \[\leadsto \mathsf{fma}\left(-0.125, \color{blue}{{\left(\frac{x}{y}\right)}^{\left(2 \cdot 2\right)}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      17. metadata-eval82.1%

        \[\leadsto \mathsf{fma}\left(-0.125, {\left(\frac{x}{y}\right)}^{\color{blue}{4}}, 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1\right) \]
      18. fma-neg82.1%

        \[\leadsto \mathsf{fma}\left(-0.125, {\left(\frac{x}{y}\right)}^{4}, \color{blue}{\mathsf{fma}\left(0.5, \frac{{x}^{2}}{{y}^{2}}, -1\right)}\right) \]
    8. Simplified87.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.125, {\left(\frac{x}{y}\right)}^{4}, \mathsf{fma}\left(0.5, {\left(\frac{x}{y}\right)}^{2}, -1\right)\right)} \]
    9. Step-by-step derivation
      1. fma-udef87.3%

        \[\leadsto \color{blue}{-0.125 \cdot {\left(\frac{x}{y}\right)}^{4} + \mathsf{fma}\left(0.5, {\left(\frac{x}{y}\right)}^{2}, -1\right)} \]
      2. fma-udef87.3%

        \[\leadsto -0.125 \cdot {\left(\frac{x}{y}\right)}^{4} + \color{blue}{\left(0.5 \cdot {\left(\frac{x}{y}\right)}^{2} + -1\right)} \]
      3. associate-+r+87.3%

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

        \[\leadsto \left(-0.125 \cdot {\left(\frac{x}{y}\right)}^{4} + \color{blue}{{\left(\frac{x}{y}\right)}^{2} \cdot 0.5}\right) + -1 \]
    10. Applied egg-rr87.3%

      \[\leadsto \color{blue}{\left(-0.125 \cdot {\left(\frac{x}{y}\right)}^{4} + {\left(\frac{x}{y}\right)}^{2} \cdot 0.5\right) + -1} \]
    11. Taylor expanded in x around 0 82.3%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{2}}{{y}^{2}}} + -1 \]
    12. Step-by-step derivation
      1. unpow282.3%

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

        \[\leadsto 0.5 \cdot \frac{x \cdot x}{\color{blue}{y \cdot y}} + -1 \]
      3. times-frac87.8%

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

        \[\leadsto 0.5 \cdot \color{blue}{{\left(\frac{x}{y}\right)}^{2}} + -1 \]
    13. Simplified87.8%

      \[\leadsto \color{blue}{0.5 \cdot {\left(\frac{x}{y}\right)}^{2}} + -1 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification86.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 2 \cdot 10^{-296}:\\ \;\;\;\;1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 10^{-134}:\\ \;\;\;\;\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^{-65}:\\ \;\;\;\;1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 2 \cdot 10^{+223}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot {\left(\frac{x}{y}\right)}^{2} + -1\\ \end{array} \]

Alternative 2: 80.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\ t_1 := y \cdot \left(y \cdot 4\right)\\ t_2 := \frac{x \cdot x - t_1}{t_1 + x \cdot x}\\ \mathbf{if}\;t_1 \leq 2 \cdot 10^{-296}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_1 \leq 10^{-134}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 10^{-65}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+223}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;-1 + \frac{\frac{\frac{x}{y}}{\frac{y}{x}}}{4}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- 1.0 (* (* y (/ y x)) (/ 8.0 x))))
        (t_1 (* y (* y 4.0)))
        (t_2 (/ (- (* x x) t_1) (+ t_1 (* x x)))))
   (if (<= t_1 2e-296)
     t_0
     (if (<= t_1 1e-134)
       t_2
       (if (<= t_1 1e-65)
         t_0
         (if (<= t_1 2e+223) t_2 (+ -1.0 (/ (/ (/ x y) (/ y x)) 4.0))))))))
double code(double x, double y) {
	double t_0 = 1.0 - ((y * (y / x)) * (8.0 / x));
	double t_1 = y * (y * 4.0);
	double t_2 = ((x * x) - t_1) / (t_1 + (x * x));
	double tmp;
	if (t_1 <= 2e-296) {
		tmp = t_0;
	} else if (t_1 <= 1e-134) {
		tmp = t_2;
	} else if (t_1 <= 1e-65) {
		tmp = t_0;
	} else if (t_1 <= 2e+223) {
		tmp = t_2;
	} else {
		tmp = -1.0 + (((x / y) / (y / x)) / 4.0);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = 1.0d0 - ((y * (y / x)) * (8.0d0 / x))
    t_1 = y * (y * 4.0d0)
    t_2 = ((x * x) - t_1) / (t_1 + (x * x))
    if (t_1 <= 2d-296) then
        tmp = t_0
    else if (t_1 <= 1d-134) then
        tmp = t_2
    else if (t_1 <= 1d-65) then
        tmp = t_0
    else if (t_1 <= 2d+223) then
        tmp = t_2
    else
        tmp = (-1.0d0) + (((x / y) / (y / x)) / 4.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 1.0 - ((y * (y / x)) * (8.0 / x));
	double t_1 = y * (y * 4.0);
	double t_2 = ((x * x) - t_1) / (t_1 + (x * x));
	double tmp;
	if (t_1 <= 2e-296) {
		tmp = t_0;
	} else if (t_1 <= 1e-134) {
		tmp = t_2;
	} else if (t_1 <= 1e-65) {
		tmp = t_0;
	} else if (t_1 <= 2e+223) {
		tmp = t_2;
	} else {
		tmp = -1.0 + (((x / y) / (y / x)) / 4.0);
	}
	return tmp;
}
def code(x, y):
	t_0 = 1.0 - ((y * (y / x)) * (8.0 / x))
	t_1 = y * (y * 4.0)
	t_2 = ((x * x) - t_1) / (t_1 + (x * x))
	tmp = 0
	if t_1 <= 2e-296:
		tmp = t_0
	elif t_1 <= 1e-134:
		tmp = t_2
	elif t_1 <= 1e-65:
		tmp = t_0
	elif t_1 <= 2e+223:
		tmp = t_2
	else:
		tmp = -1.0 + (((x / y) / (y / x)) / 4.0)
	return tmp
function code(x, y)
	t_0 = Float64(1.0 - Float64(Float64(y * Float64(y / x)) * Float64(8.0 / x)))
	t_1 = Float64(y * Float64(y * 4.0))
	t_2 = Float64(Float64(Float64(x * x) - t_1) / Float64(t_1 + Float64(x * x)))
	tmp = 0.0
	if (t_1 <= 2e-296)
		tmp = t_0;
	elseif (t_1 <= 1e-134)
		tmp = t_2;
	elseif (t_1 <= 1e-65)
		tmp = t_0;
	elseif (t_1 <= 2e+223)
		tmp = t_2;
	else
		tmp = Float64(-1.0 + Float64(Float64(Float64(x / y) / Float64(y / x)) / 4.0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 1.0 - ((y * (y / x)) * (8.0 / x));
	t_1 = y * (y * 4.0);
	t_2 = ((x * x) - t_1) / (t_1 + (x * x));
	tmp = 0.0;
	if (t_1 <= 2e-296)
		tmp = t_0;
	elseif (t_1 <= 1e-134)
		tmp = t_2;
	elseif (t_1 <= 1e-65)
		tmp = t_0;
	elseif (t_1 <= 2e+223)
		tmp = t_2;
	else
		tmp = -1.0 + (((x / y) / (y / x)) / 4.0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(N[(y * N[(y / x), $MachinePrecision]), $MachinePrecision] * N[(8.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * x), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(t$95$1 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-296], t$95$0, If[LessEqual[t$95$1, 1e-134], t$95$2, If[LessEqual[t$95$1, 1e-65], t$95$0, If[LessEqual[t$95$1, 2e+223], t$95$2, N[(-1.0 + N[(N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\
t_1 := y \cdot \left(y \cdot 4\right)\\
t_2 := \frac{x \cdot x - t_1}{t_1 + x \cdot x}\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{-296}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;t_1 \leq 10^{-134}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+223}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;-1 + \frac{\frac{\frac{x}{y}}{\frac{y}{x}}}{4}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y 4) y) < 2e-296 or 1.00000000000000004e-134 < (*.f64 (*.f64 y 4) y) < 9.99999999999999923e-66

    1. Initial program 57.5%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Step-by-step derivation
      1. frac-2neg57.5%

        \[\leadsto \color{blue}{\frac{-\left(x \cdot x - \left(y \cdot 4\right) \cdot y\right)}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)}} \]
      2. div-inv57.4%

        \[\leadsto \color{blue}{\left(-\left(x \cdot x - \left(y \cdot 4\right) \cdot y\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)}} \]
      3. sub-neg57.4%

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

        \[\leadsto \left(-\color{blue}{\left(\left(-\left(y \cdot 4\right) \cdot y\right) + x \cdot x\right)}\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      5. *-commutative57.4%

        \[\leadsto \left(-\left(\left(-\color{blue}{y \cdot \left(y \cdot 4\right)}\right) + x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      6. distribute-rgt-neg-in57.4%

        \[\leadsto \left(-\left(\color{blue}{y \cdot \left(-y \cdot 4\right)} + x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      7. fma-def57.4%

        \[\leadsto \left(-\color{blue}{\mathsf{fma}\left(y, -y \cdot 4, x \cdot x\right)}\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      8. distribute-rgt-neg-in57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, \color{blue}{y \cdot \left(-4\right)}, x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      9. metadata-eval57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot \color{blue}{-4}, x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      10. +-commutative57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{-\color{blue}{\left(\left(y \cdot 4\right) \cdot y + x \cdot x\right)}} \]
      11. distribute-neg-in57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{\left(-\left(y \cdot 4\right) \cdot y\right) + \left(-x \cdot x\right)}} \]
      12. *-commutative57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\left(-\color{blue}{y \cdot \left(y \cdot 4\right)}\right) + \left(-x \cdot x\right)} \]
      13. distribute-rgt-neg-in57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{y \cdot \left(-y \cdot 4\right)} + \left(-x \cdot x\right)} \]
      14. fma-def57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{\mathsf{fma}\left(y, -y \cdot 4, -x \cdot x\right)}} \]
      15. distribute-rgt-neg-in57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, \color{blue}{y \cdot \left(-4\right)}, -x \cdot x\right)} \]
      16. metadata-eval57.4%

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

      \[\leadsto \color{blue}{\left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, -x \cdot x\right)}} \]
    4. Step-by-step derivation
      1. distribute-rgt-neg-in57.4%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, \color{blue}{x \cdot \left(-x\right)}\right)} \]
    5. Simplified57.4%

      \[\leadsto \color{blue}{\left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, x \cdot \left(-x\right)\right)}} \]
    6. Step-by-step derivation
      1. fma-udef57.4%

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

      \[\leadsto \left(-\color{blue}{\left(y \cdot \left(y \cdot -4\right) + x \cdot x\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, x \cdot \left(-x\right)\right)} \]
    8. Taylor expanded in x around inf 82.5%

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{{x}^{2}}} \]
    9. Step-by-step derivation
      1. mul-1-neg82.5%

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

        \[\leadsto \color{blue}{1 - \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{{x}^{2}}} \]
      3. unpow282.5%

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

        \[\leadsto 1 - \frac{4 \cdot \color{blue}{\left(y \cdot y\right)} - -4 \cdot \left(y \cdot y\right)}{{x}^{2}} \]
      5. distribute-rgt-out--82.5%

        \[\leadsto 1 - \frac{\color{blue}{\left(y \cdot y\right) \cdot \left(4 - -4\right)}}{{x}^{2}} \]
      6. metadata-eval82.5%

        \[\leadsto 1 - \frac{\left(y \cdot y\right) \cdot \color{blue}{8}}{{x}^{2}} \]
      7. unpow282.5%

        \[\leadsto 1 - \frac{\left(y \cdot y\right) \cdot 8}{\color{blue}{x \cdot x}} \]
      8. times-frac90.2%

        \[\leadsto 1 - \color{blue}{\frac{y \cdot y}{x} \cdot \frac{8}{x}} \]
      9. associate-*r/90.7%

        \[\leadsto 1 - \color{blue}{\left(y \cdot \frac{y}{x}\right)} \cdot \frac{8}{x} \]
    10. Simplified90.7%

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

    if 2e-296 < (*.f64 (*.f64 y 4) y) < 1.00000000000000004e-134 or 9.99999999999999923e-66 < (*.f64 (*.f64 y 4) y) < 2.00000000000000009e223

    1. Initial program 81.6%

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

    if 2.00000000000000009e223 < (*.f64 (*.f64 y 4) y)

    1. Initial program 14.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 14.3%

      \[\leadsto \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\color{blue}{4 \cdot {y}^{2}}} \]
    3. Step-by-step derivation
      1. *-commutative14.3%

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

        \[\leadsto \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\color{blue}{\left(y \cdot y\right)} \cdot 4} \]
      3. associate-*r*14.3%

        \[\leadsto \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\color{blue}{y \cdot \left(y \cdot 4\right)}} \]
    4. Simplified14.3%

      \[\leadsto \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\color{blue}{y \cdot \left(y \cdot 4\right)}} \]
    5. Step-by-step derivation
      1. div-sub14.3%

        \[\leadsto \color{blue}{\frac{x \cdot x}{y \cdot \left(y \cdot 4\right)} - \frac{\left(y \cdot 4\right) \cdot y}{y \cdot \left(y \cdot 4\right)}} \]
      2. associate-*r*14.3%

        \[\leadsto \frac{x \cdot x}{\color{blue}{\left(y \cdot y\right) \cdot 4}} - \frac{\left(y \cdot 4\right) \cdot y}{y \cdot \left(y \cdot 4\right)} \]
      3. associate-/r*14.3%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y} \cdot \frac{x}{y}}}{4} - \frac{\left(y \cdot 4\right) \cdot y}{y \cdot \left(y \cdot 4\right)} \]
      5. pow214.4%

        \[\leadsto \frac{\color{blue}{{\left(\frac{x}{y}\right)}^{2}}}{4} - \frac{\left(y \cdot 4\right) \cdot y}{y \cdot \left(y \cdot 4\right)} \]
      6. *-commutative14.4%

        \[\leadsto \frac{{\left(\frac{x}{y}\right)}^{2}}{4} - \frac{\left(y \cdot 4\right) \cdot y}{\color{blue}{\left(y \cdot 4\right) \cdot y}} \]
      7. *-inverses87.8%

        \[\leadsto \frac{{\left(\frac{x}{y}\right)}^{2}}{4} - \color{blue}{1} \]
    6. Applied egg-rr87.8%

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{y}\right)}^{2}}{4} - 1} \]
    7. Step-by-step derivation
      1. unpow287.8%

        \[\leadsto \frac{\color{blue}{\frac{x}{y} \cdot \frac{x}{y}}}{4} - 1 \]
      2. clear-num87.8%

        \[\leadsto \frac{\frac{x}{y} \cdot \color{blue}{\frac{1}{\frac{y}{x}}}}{4} - 1 \]
      3. un-div-inv87.8%

        \[\leadsto \frac{\color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}}}{4} - 1 \]
    8. Applied egg-rr87.8%

      \[\leadsto \frac{\color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}}}{4} - 1 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification86.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 2 \cdot 10^{-296}:\\ \;\;\;\;1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 10^{-134}:\\ \;\;\;\;\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^{-65}:\\ \;\;\;\;1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 2 \cdot 10^{+223}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;-1 + \frac{\frac{\frac{x}{y}}{\frac{y}{x}}}{4}\\ \end{array} \]

Alternative 3: 75.3% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 10^{-65}:\\ \;\;\;\;1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\ \mathbf{else}:\\ \;\;\;\;-1 + \frac{\frac{\frac{x}{y}}{\frac{y}{x}}}{4}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= (* y (* y 4.0)) 1e-65)
   (- 1.0 (* (* y (/ y x)) (/ 8.0 x)))
   (+ -1.0 (/ (/ (/ x y) (/ y x)) 4.0))))
double code(double x, double y) {
	double tmp;
	if ((y * (y * 4.0)) <= 1e-65) {
		tmp = 1.0 - ((y * (y / x)) * (8.0 / x));
	} else {
		tmp = -1.0 + (((x / y) / (y / x)) / 4.0);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y * (y * 4.0d0)) <= 1d-65) then
        tmp = 1.0d0 - ((y * (y / x)) * (8.0d0 / x))
    else
        tmp = (-1.0d0) + (((x / y) / (y / x)) / 4.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y * (y * 4.0)) <= 1e-65) {
		tmp = 1.0 - ((y * (y / x)) * (8.0 / x));
	} else {
		tmp = -1.0 + (((x / y) / (y / x)) / 4.0);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y * (y * 4.0)) <= 1e-65:
		tmp = 1.0 - ((y * (y / x)) * (8.0 / x))
	else:
		tmp = -1.0 + (((x / y) / (y / x)) / 4.0)
	return tmp
function code(x, y)
	tmp = 0.0
	if (Float64(y * Float64(y * 4.0)) <= 1e-65)
		tmp = Float64(1.0 - Float64(Float64(y * Float64(y / x)) * Float64(8.0 / x)));
	else
		tmp = Float64(-1.0 + Float64(Float64(Float64(x / y) / Float64(y / x)) / 4.0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y * (y * 4.0)) <= 1e-65)
		tmp = 1.0 - ((y * (y / x)) * (8.0 / x));
	else
		tmp = -1.0 + (((x / y) / (y / x)) / 4.0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], 1e-65], N[(1.0 - N[(N[(y * N[(y / x), $MachinePrecision]), $MachinePrecision] * N[(8.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[(N[(x / y), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 10^{-65}:\\
\;\;\;\;1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\

\mathbf{else}:\\
\;\;\;\;-1 + \frac{\frac{\frac{x}{y}}{\frac{y}{x}}}{4}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 y 4) y) < 9.99999999999999923e-66

    1. Initial program 67.2%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Step-by-step derivation
      1. frac-2neg67.2%

        \[\leadsto \color{blue}{\frac{-\left(x \cdot x - \left(y \cdot 4\right) \cdot y\right)}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)}} \]
      2. div-inv67.1%

        \[\leadsto \color{blue}{\left(-\left(x \cdot x - \left(y \cdot 4\right) \cdot y\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)}} \]
      3. sub-neg67.1%

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

        \[\leadsto \left(-\color{blue}{\left(\left(-\left(y \cdot 4\right) \cdot y\right) + x \cdot x\right)}\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      5. *-commutative67.1%

        \[\leadsto \left(-\left(\left(-\color{blue}{y \cdot \left(y \cdot 4\right)}\right) + x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      6. distribute-rgt-neg-in67.1%

        \[\leadsto \left(-\left(\color{blue}{y \cdot \left(-y \cdot 4\right)} + x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      7. fma-def67.1%

        \[\leadsto \left(-\color{blue}{\mathsf{fma}\left(y, -y \cdot 4, x \cdot x\right)}\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      8. distribute-rgt-neg-in67.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, \color{blue}{y \cdot \left(-4\right)}, x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      9. metadata-eval67.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot \color{blue}{-4}, x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      10. +-commutative67.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{-\color{blue}{\left(\left(y \cdot 4\right) \cdot y + x \cdot x\right)}} \]
      11. distribute-neg-in67.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{\left(-\left(y \cdot 4\right) \cdot y\right) + \left(-x \cdot x\right)}} \]
      12. *-commutative67.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\left(-\color{blue}{y \cdot \left(y \cdot 4\right)}\right) + \left(-x \cdot x\right)} \]
      13. distribute-rgt-neg-in67.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{y \cdot \left(-y \cdot 4\right)} + \left(-x \cdot x\right)} \]
      14. fma-def67.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{\mathsf{fma}\left(y, -y \cdot 4, -x \cdot x\right)}} \]
      15. distribute-rgt-neg-in67.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, \color{blue}{y \cdot \left(-4\right)}, -x \cdot x\right)} \]
      16. metadata-eval67.1%

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

      \[\leadsto \color{blue}{\left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, -x \cdot x\right)}} \]
    4. Step-by-step derivation
      1. distribute-rgt-neg-in67.1%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, \color{blue}{x \cdot \left(-x\right)}\right)} \]
    5. Simplified67.1%

      \[\leadsto \color{blue}{\left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, x \cdot \left(-x\right)\right)}} \]
    6. Step-by-step derivation
      1. fma-udef67.1%

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

      \[\leadsto \left(-\color{blue}{\left(y \cdot \left(y \cdot -4\right) + x \cdot x\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, x \cdot \left(-x\right)\right)} \]
    8. Taylor expanded in x around inf 78.1%

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{{x}^{2}}} \]
    9. Step-by-step derivation
      1. mul-1-neg78.1%

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

        \[\leadsto \color{blue}{1 - \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{{x}^{2}}} \]
      3. unpow278.1%

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

        \[\leadsto 1 - \frac{4 \cdot \color{blue}{\left(y \cdot y\right)} - -4 \cdot \left(y \cdot y\right)}{{x}^{2}} \]
      5. distribute-rgt-out--78.1%

        \[\leadsto 1 - \frac{\color{blue}{\left(y \cdot y\right) \cdot \left(4 - -4\right)}}{{x}^{2}} \]
      6. metadata-eval78.1%

        \[\leadsto 1 - \frac{\left(y \cdot y\right) \cdot \color{blue}{8}}{{x}^{2}} \]
      7. unpow278.1%

        \[\leadsto 1 - \frac{\left(y \cdot y\right) \cdot 8}{\color{blue}{x \cdot x}} \]
      8. times-frac83.4%

        \[\leadsto 1 - \color{blue}{\frac{y \cdot y}{x} \cdot \frac{8}{x}} \]
      9. associate-*r/83.7%

        \[\leadsto 1 - \color{blue}{\left(y \cdot \frac{y}{x}\right)} \cdot \frac{8}{x} \]
    10. Simplified83.7%

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

    if 9.99999999999999923e-66 < (*.f64 (*.f64 y 4) y)

    1. Initial program 42.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 36.3%

      \[\leadsto \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\color{blue}{4 \cdot {y}^{2}}} \]
    3. Step-by-step derivation
      1. *-commutative36.3%

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

        \[\leadsto \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\color{blue}{\left(y \cdot y\right)} \cdot 4} \]
      3. associate-*r*36.3%

        \[\leadsto \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\color{blue}{y \cdot \left(y \cdot 4\right)}} \]
    4. Simplified36.3%

      \[\leadsto \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\color{blue}{y \cdot \left(y \cdot 4\right)}} \]
    5. Step-by-step derivation
      1. div-sub36.3%

        \[\leadsto \color{blue}{\frac{x \cdot x}{y \cdot \left(y \cdot 4\right)} - \frac{\left(y \cdot 4\right) \cdot y}{y \cdot \left(y \cdot 4\right)}} \]
      2. associate-*r*36.3%

        \[\leadsto \frac{x \cdot x}{\color{blue}{\left(y \cdot y\right) \cdot 4}} - \frac{\left(y \cdot 4\right) \cdot y}{y \cdot \left(y \cdot 4\right)} \]
      3. associate-/r*36.3%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot x}{y \cdot y}}{4}} - \frac{\left(y \cdot 4\right) \cdot y}{y \cdot \left(y \cdot 4\right)} \]
      4. frac-times36.3%

        \[\leadsto \frac{\color{blue}{\frac{x}{y} \cdot \frac{x}{y}}}{4} - \frac{\left(y \cdot 4\right) \cdot y}{y \cdot \left(y \cdot 4\right)} \]
      5. pow236.3%

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

        \[\leadsto \frac{{\left(\frac{x}{y}\right)}^{2}}{4} - \frac{\left(y \cdot 4\right) \cdot y}{\color{blue}{\left(y \cdot 4\right) \cdot y}} \]
      7. *-inverses77.2%

        \[\leadsto \frac{{\left(\frac{x}{y}\right)}^{2}}{4} - \color{blue}{1} \]
    6. Applied egg-rr77.2%

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{y}\right)}^{2}}{4} - 1} \]
    7. Step-by-step derivation
      1. unpow277.2%

        \[\leadsto \frac{\color{blue}{\frac{x}{y} \cdot \frac{x}{y}}}{4} - 1 \]
      2. clear-num77.2%

        \[\leadsto \frac{\frac{x}{y} \cdot \color{blue}{\frac{1}{\frac{y}{x}}}}{4} - 1 \]
      3. un-div-inv77.2%

        \[\leadsto \frac{\color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}}}{4} - 1 \]
    8. Applied egg-rr77.2%

      \[\leadsto \frac{\color{blue}{\frac{\frac{x}{y}}{\frac{y}{x}}}}{4} - 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 10^{-65}:\\ \;\;\;\;1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\ \mathbf{else}:\\ \;\;\;\;-1 + \frac{\frac{\frac{x}{y}}{\frac{y}{x}}}{4}\\ \end{array} \]

Alternative 4: 75.0% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.05 \cdot 10^{-31}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-6}:\\ \;\;\;\;1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.05e-31)
   -1.0
   (if (<= y 1.9e-6) (- 1.0 (* (* y (/ y x)) (/ 8.0 x))) -1.0)))
double code(double x, double y) {
	double tmp;
	if (y <= -1.05e-31) {
		tmp = -1.0;
	} else if (y <= 1.9e-6) {
		tmp = 1.0 - ((y * (y / x)) * (8.0 / x));
	} else {
		tmp = -1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-1.05d-31)) then
        tmp = -1.0d0
    else if (y <= 1.9d-6) then
        tmp = 1.0d0 - ((y * (y / x)) * (8.0d0 / x))
    else
        tmp = -1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.05e-31) {
		tmp = -1.0;
	} else if (y <= 1.9e-6) {
		tmp = 1.0 - ((y * (y / x)) * (8.0 / x));
	} else {
		tmp = -1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.05e-31:
		tmp = -1.0
	elif y <= 1.9e-6:
		tmp = 1.0 - ((y * (y / x)) * (8.0 / x))
	else:
		tmp = -1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.05e-31)
		tmp = -1.0;
	elseif (y <= 1.9e-6)
		tmp = Float64(1.0 - Float64(Float64(y * Float64(y / x)) * Float64(8.0 / x)));
	else
		tmp = -1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.05e-31)
		tmp = -1.0;
	elseif (y <= 1.9e-6)
		tmp = 1.0 - ((y * (y / x)) * (8.0 / x));
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.05e-31], -1.0, If[LessEqual[y, 1.9e-6], N[(1.0 - N[(N[(y * N[(y / x), $MachinePrecision]), $MachinePrecision] * N[(8.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-31}:\\
\;\;\;\;-1\\

\mathbf{elif}\;y \leq 1.9 \cdot 10^{-6}:\\
\;\;\;\;1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.04999999999999996e-31 or 1.9e-6 < y

    1. Initial program 41.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 0 77.2%

      \[\leadsto \color{blue}{-1} \]

    if -1.04999999999999996e-31 < y < 1.9e-6

    1. Initial program 66.7%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Step-by-step derivation
      1. frac-2neg66.7%

        \[\leadsto \color{blue}{\frac{-\left(x \cdot x - \left(y \cdot 4\right) \cdot y\right)}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)}} \]
      2. div-inv66.5%

        \[\leadsto \color{blue}{\left(-\left(x \cdot x - \left(y \cdot 4\right) \cdot y\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)}} \]
      3. sub-neg66.5%

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

        \[\leadsto \left(-\color{blue}{\left(\left(-\left(y \cdot 4\right) \cdot y\right) + x \cdot x\right)}\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      5. *-commutative66.5%

        \[\leadsto \left(-\left(\left(-\color{blue}{y \cdot \left(y \cdot 4\right)}\right) + x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      6. distribute-rgt-neg-in66.5%

        \[\leadsto \left(-\left(\color{blue}{y \cdot \left(-y \cdot 4\right)} + x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      7. fma-def66.5%

        \[\leadsto \left(-\color{blue}{\mathsf{fma}\left(y, -y \cdot 4, x \cdot x\right)}\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      8. distribute-rgt-neg-in66.5%

        \[\leadsto \left(-\mathsf{fma}\left(y, \color{blue}{y \cdot \left(-4\right)}, x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      9. metadata-eval66.5%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot \color{blue}{-4}, x \cdot x\right)\right) \cdot \frac{1}{-\left(x \cdot x + \left(y \cdot 4\right) \cdot y\right)} \]
      10. +-commutative66.5%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{-\color{blue}{\left(\left(y \cdot 4\right) \cdot y + x \cdot x\right)}} \]
      11. distribute-neg-in66.5%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{\left(-\left(y \cdot 4\right) \cdot y\right) + \left(-x \cdot x\right)}} \]
      12. *-commutative66.5%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\left(-\color{blue}{y \cdot \left(y \cdot 4\right)}\right) + \left(-x \cdot x\right)} \]
      13. distribute-rgt-neg-in66.5%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{y \cdot \left(-y \cdot 4\right)} + \left(-x \cdot x\right)} \]
      14. fma-def66.5%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\color{blue}{\mathsf{fma}\left(y, -y \cdot 4, -x \cdot x\right)}} \]
      15. distribute-rgt-neg-in66.5%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, \color{blue}{y \cdot \left(-4\right)}, -x \cdot x\right)} \]
      16. metadata-eval66.5%

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

      \[\leadsto \color{blue}{\left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, -x \cdot x\right)}} \]
    4. Step-by-step derivation
      1. distribute-rgt-neg-in66.5%

        \[\leadsto \left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, \color{blue}{x \cdot \left(-x\right)}\right)} \]
    5. Simplified66.5%

      \[\leadsto \color{blue}{\left(-\mathsf{fma}\left(y, y \cdot -4, x \cdot x\right)\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, x \cdot \left(-x\right)\right)}} \]
    6. Step-by-step derivation
      1. fma-udef66.5%

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

      \[\leadsto \left(-\color{blue}{\left(y \cdot \left(y \cdot -4\right) + x \cdot x\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(y, y \cdot -4, x \cdot \left(-x\right)\right)} \]
    8. Taylor expanded in x around inf 77.2%

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{{x}^{2}}} \]
    9. Step-by-step derivation
      1. mul-1-neg77.2%

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

        \[\leadsto \color{blue}{1 - \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{{x}^{2}}} \]
      3. unpow277.2%

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

        \[\leadsto 1 - \frac{4 \cdot \color{blue}{\left(y \cdot y\right)} - -4 \cdot \left(y \cdot y\right)}{{x}^{2}} \]
      5. distribute-rgt-out--77.2%

        \[\leadsto 1 - \frac{\color{blue}{\left(y \cdot y\right) \cdot \left(4 - -4\right)}}{{x}^{2}} \]
      6. metadata-eval77.2%

        \[\leadsto 1 - \frac{\left(y \cdot y\right) \cdot \color{blue}{8}}{{x}^{2}} \]
      7. unpow277.2%

        \[\leadsto 1 - \frac{\left(y \cdot y\right) \cdot 8}{\color{blue}{x \cdot x}} \]
      8. times-frac82.4%

        \[\leadsto 1 - \color{blue}{\frac{y \cdot y}{x} \cdot \frac{8}{x}} \]
      9. associate-*r/82.7%

        \[\leadsto 1 - \color{blue}{\left(y \cdot \frac{y}{x}\right)} \cdot \frac{8}{x} \]
    10. Simplified82.7%

      \[\leadsto \color{blue}{1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.05 \cdot 10^{-31}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-6}:\\ \;\;\;\;1 - \left(y \cdot \frac{y}{x}\right) \cdot \frac{8}{x}\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]

Alternative 5: 74.3% accurate, 3.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-29}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-32}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1e-29) -1.0 (if (<= y 2e-32) 1.0 -1.0)))
double code(double x, double y) {
	double tmp;
	if (y <= -1e-29) {
		tmp = -1.0;
	} else if (y <= 2e-32) {
		tmp = 1.0;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-1d-29)) then
        tmp = -1.0d0
    else if (y <= 2d-32) then
        tmp = 1.0d0
    else
        tmp = -1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1e-29) {
		tmp = -1.0;
	} else if (y <= 2e-32) {
		tmp = 1.0;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1e-29:
		tmp = -1.0
	elif y <= 2e-32:
		tmp = 1.0
	else:
		tmp = -1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1e-29)
		tmp = -1.0;
	elseif (y <= 2e-32)
		tmp = 1.0;
	else
		tmp = -1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1e-29)
		tmp = -1.0;
	elseif (y <= 2e-32)
		tmp = 1.0;
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1e-29], -1.0, If[LessEqual[y, 2e-32], 1.0, -1.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-29}:\\
\;\;\;\;-1\\

\mathbf{elif}\;y \leq 2 \cdot 10^{-32}:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.99999999999999943e-30 or 2.00000000000000011e-32 < y

    1. Initial program 42.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 76.5%

      \[\leadsto \color{blue}{-1} \]

    if -9.99999999999999943e-30 < y < 2.00000000000000011e-32

    1. Initial program 67.2%

      \[\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 82.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-29}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-32}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]

Alternative 6: 50.9% accurate, 19.0× speedup?

\[\begin{array}{l} \\ -1 \end{array} \]
(FPCore (x y) :precision binary64 -1.0)
double code(double x, double y) {
	return -1.0;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = -1.0d0
end function
public static double code(double x, double y) {
	return -1.0;
}
def code(x, y):
	return -1.0
function code(x, y)
	return -1.0
end
function tmp = code(x, y)
	tmp = -1.0;
end
code[x_, y_] := -1.0
\begin{array}{l}

\\
-1
\end{array}
Derivation
  1. Initial program 53.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 0 50.0%

    \[\leadsto \color{blue}{-1} \]
  3. Final simplification50.0%

    \[\leadsto -1 \]

Developer target: 50.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y \cdot y\right) \cdot 4\\ t_1 := x \cdot x + t_0\\ t_2 := \frac{t_0}{t_1}\\ t_3 := \left(y \cdot 4\right) \cdot y\\ \mathbf{if}\;\frac{x \cdot x - t_3}{x \cdot x + t_3} < 0.9743233849626781:\\ \;\;\;\;\frac{x \cdot x}{t_1} - t_2\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x}{\sqrt{t_1}}\right)}^{2} - t_2\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (* y y) 4.0))
        (t_1 (+ (* x x) t_0))
        (t_2 (/ t_0 t_1))
        (t_3 (* (* y 4.0) y)))
   (if (< (/ (- (* x x) t_3) (+ (* x x) t_3)) 0.9743233849626781)
     (- (/ (* x x) t_1) t_2)
     (- (pow (/ x (sqrt t_1)) 2.0) t_2))))
double code(double x, double y) {
	double t_0 = (y * y) * 4.0;
	double t_1 = (x * x) + t_0;
	double t_2 = t_0 / t_1;
	double t_3 = (y * 4.0) * y;
	double tmp;
	if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781) {
		tmp = ((x * x) / t_1) - t_2;
	} else {
		tmp = pow((x / sqrt(t_1)), 2.0) - t_2;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = (y * y) * 4.0d0
    t_1 = (x * x) + t_0
    t_2 = t_0 / t_1
    t_3 = (y * 4.0d0) * y
    if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781d0) then
        tmp = ((x * x) / t_1) - t_2
    else
        tmp = ((x / sqrt(t_1)) ** 2.0d0) - t_2
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (y * y) * 4.0;
	double t_1 = (x * x) + t_0;
	double t_2 = t_0 / t_1;
	double t_3 = (y * 4.0) * y;
	double tmp;
	if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781) {
		tmp = ((x * x) / t_1) - t_2;
	} else {
		tmp = Math.pow((x / Math.sqrt(t_1)), 2.0) - t_2;
	}
	return tmp;
}
def code(x, y):
	t_0 = (y * y) * 4.0
	t_1 = (x * x) + t_0
	t_2 = t_0 / t_1
	t_3 = (y * 4.0) * y
	tmp = 0
	if (((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781:
		tmp = ((x * x) / t_1) - t_2
	else:
		tmp = math.pow((x / math.sqrt(t_1)), 2.0) - t_2
	return tmp
function code(x, y)
	t_0 = Float64(Float64(y * y) * 4.0)
	t_1 = Float64(Float64(x * x) + t_0)
	t_2 = Float64(t_0 / t_1)
	t_3 = Float64(Float64(y * 4.0) * y)
	tmp = 0.0
	if (Float64(Float64(Float64(x * x) - t_3) / Float64(Float64(x * x) + t_3)) < 0.9743233849626781)
		tmp = Float64(Float64(Float64(x * x) / t_1) - t_2);
	else
		tmp = Float64((Float64(x / sqrt(t_1)) ^ 2.0) - t_2);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (y * y) * 4.0;
	t_1 = (x * x) + t_0;
	t_2 = t_0 / t_1;
	t_3 = (y * 4.0) * y;
	tmp = 0.0;
	if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781)
		tmp = ((x * x) / t_1) - t_2;
	else
		tmp = ((x / sqrt(t_1)) ^ 2.0) - t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * y), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]}, If[Less[N[(N[(N[(x * x), $MachinePrecision] - t$95$3), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], 0.9743233849626781], N[(N[(N[(x * x), $MachinePrecision] / t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision], N[(N[Power[N[(x / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(y \cdot y\right) \cdot 4\\
t_1 := x \cdot x + t_0\\
t_2 := \frac{t_0}{t_1}\\
t_3 := \left(y \cdot 4\right) \cdot y\\
\mathbf{if}\;\frac{x \cdot x - t_3}{x \cdot x + t_3} < 0.9743233849626781:\\
\;\;\;\;\frac{x \cdot x}{t_1} - t_2\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{x}{\sqrt{t_1}}\right)}^{2} - t_2\\


\end{array}
\end{array}

Reproduce

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