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

Percentage Accurate: 50.3% → 99.9%
Time: 10.0s
Alternatives: 9
Speedup: 2.6×

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 9 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: 99.9% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(x, y + y\right)\\ \frac{\frac{x}{t_0}}{\frac{t_0}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (hypot x (+ y y))))
   (- (/ (/ x t_0) (/ t_0 x)) (pow (/ (* y 2.0) (hypot x (* y 2.0))) 2.0))))
double code(double x, double y) {
	double t_0 = hypot(x, (y + y));
	return ((x / t_0) / (t_0 / x)) - pow(((y * 2.0) / hypot(x, (y * 2.0))), 2.0);
}
public static double code(double x, double y) {
	double t_0 = Math.hypot(x, (y + y));
	return ((x / t_0) / (t_0 / x)) - Math.pow(((y * 2.0) / Math.hypot(x, (y * 2.0))), 2.0);
}
def code(x, y):
	t_0 = math.hypot(x, (y + y))
	return ((x / t_0) / (t_0 / x)) - math.pow(((y * 2.0) / math.hypot(x, (y * 2.0))), 2.0)
function code(x, y)
	t_0 = hypot(x, Float64(y + y))
	return Float64(Float64(Float64(x / t_0) / Float64(t_0 / x)) - (Float64(Float64(y * 2.0) / hypot(x, Float64(y * 2.0))) ^ 2.0))
end
function tmp = code(x, y)
	t_0 = hypot(x, (y + y));
	tmp = ((x / t_0) / (t_0 / x)) - (((y * 2.0) / hypot(x, (y * 2.0))) ^ 2.0);
end
code[x_, y_] := Block[{t$95$0 = N[Sqrt[x ^ 2 + N[(y + y), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[(N[(x / t$95$0), $MachinePrecision] / N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision] - N[Power[N[(N[(y * 2.0), $MachinePrecision] / N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y + y\right)\\
\frac{\frac{x}{t_0}}{\frac{t_0}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}
\end{array}
\end{array}
Derivation
  1. Initial program 49.6%

    \[\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. div-sub49.6%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} + \left(-{\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}\right)} \]
  5. Step-by-step derivation
    1. unsub-neg99.6%

      \[\leadsto \color{blue}{{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}} \]
  6. Simplified99.6%

    \[\leadsto \color{blue}{{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}} \]
  7. Step-by-step derivation
    1. unpow299.6%

      \[\leadsto \color{blue}{\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    2. metadata-eval99.6%

      \[\leadsto \frac{x}{\mathsf{hypot}\left(x, y \cdot \color{blue}{\frac{1}{0.5}}\right)} \cdot \frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    3. div-inv99.6%

      \[\leadsto \frac{x}{\mathsf{hypot}\left(x, \color{blue}{\frac{y}{0.5}}\right)} \cdot \frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    4. clear-num99.6%

      \[\leadsto \frac{x}{\mathsf{hypot}\left(x, \frac{y}{0.5}\right)} \cdot \color{blue}{\frac{1}{\frac{\mathsf{hypot}\left(x, y \cdot 2\right)}{x}}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    5. un-div-inv99.6%

      \[\leadsto \color{blue}{\frac{\frac{x}{\mathsf{hypot}\left(x, \frac{y}{0.5}\right)}}{\frac{\mathsf{hypot}\left(x, y \cdot 2\right)}{x}}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    6. div-inv99.6%

      \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, \color{blue}{y \cdot \frac{1}{0.5}}\right)}}{\frac{\mathsf{hypot}\left(x, y \cdot 2\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    7. metadata-eval99.6%

      \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, y \cdot \color{blue}{2}\right)}}{\frac{\mathsf{hypot}\left(x, y \cdot 2\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    8. add-log-exp82.9%

      \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, \color{blue}{\log \left(e^{y \cdot 2}\right)}\right)}}{\frac{\mathsf{hypot}\left(x, y \cdot 2\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    9. exp-lft-sqr82.9%

      \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, \log \color{blue}{\left(e^{y} \cdot e^{y}\right)}\right)}}{\frac{\mathsf{hypot}\left(x, y \cdot 2\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    10. log-prod83.3%

      \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, \color{blue}{\log \left(e^{y}\right) + \log \left(e^{y}\right)}\right)}}{\frac{\mathsf{hypot}\left(x, y \cdot 2\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    11. add-log-exp83.4%

      \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, \color{blue}{y} + \log \left(e^{y}\right)\right)}}{\frac{\mathsf{hypot}\left(x, y \cdot 2\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    12. add-log-exp99.6%

      \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, y + \color{blue}{y}\right)}}{\frac{\mathsf{hypot}\left(x, y \cdot 2\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    13. add-log-exp82.9%

      \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, y + y\right)}}{\frac{\mathsf{hypot}\left(x, \color{blue}{\log \left(e^{y \cdot 2}\right)}\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    14. exp-lft-sqr82.9%

      \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, y + y\right)}}{\frac{\mathsf{hypot}\left(x, \log \color{blue}{\left(e^{y} \cdot e^{y}\right)}\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    15. log-prod83.3%

      \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, y + y\right)}}{\frac{\mathsf{hypot}\left(x, \color{blue}{\log \left(e^{y}\right) + \log \left(e^{y}\right)}\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    16. add-log-exp83.4%

      \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, y + y\right)}}{\frac{\mathsf{hypot}\left(x, \color{blue}{y} + \log \left(e^{y}\right)\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    17. add-log-exp99.6%

      \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, y + y\right)}}{\frac{\mathsf{hypot}\left(x, y + \color{blue}{y}\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
  8. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{\frac{x}{\mathsf{hypot}\left(x, y + y\right)}}{\frac{\mathsf{hypot}\left(x, y + y\right)}{x}}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
  9. Final simplification99.6%

    \[\leadsto \frac{\frac{x}{\mathsf{hypot}\left(x, y + y\right)}}{\frac{\mathsf{hypot}\left(x, y + y\right)}{x}} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]

Alternative 2: 99.9% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\ {\left(\frac{x}{t_0}\right)}^{2} - {\left(\frac{y \cdot 2}{t_0}\right)}^{2} \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (hypot x (* y 2.0))))
   (- (pow (/ x t_0) 2.0) (pow (/ (* y 2.0) t_0) 2.0))))
double code(double x, double y) {
	double t_0 = hypot(x, (y * 2.0));
	return pow((x / t_0), 2.0) - pow(((y * 2.0) / t_0), 2.0);
}
public static double code(double x, double y) {
	double t_0 = Math.hypot(x, (y * 2.0));
	return Math.pow((x / t_0), 2.0) - Math.pow(((y * 2.0) / t_0), 2.0);
}
def code(x, y):
	t_0 = math.hypot(x, (y * 2.0))
	return math.pow((x / t_0), 2.0) - math.pow(((y * 2.0) / t_0), 2.0)
function code(x, y)
	t_0 = hypot(x, Float64(y * 2.0))
	return Float64((Float64(x / t_0) ^ 2.0) - (Float64(Float64(y * 2.0) / t_0) ^ 2.0))
end
function tmp = code(x, y)
	t_0 = hypot(x, (y * 2.0));
	tmp = ((x / t_0) ^ 2.0) - (((y * 2.0) / t_0) ^ 2.0);
end
code[x_, y_] := Block[{t$95$0 = N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[Power[N[(x / t$95$0), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(N[(y * 2.0), $MachinePrecision] / t$95$0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
{\left(\frac{x}{t_0}\right)}^{2} - {\left(\frac{y \cdot 2}{t_0}\right)}^{2}
\end{array}
\end{array}
Derivation
  1. Initial program 49.6%

    \[\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. div-sub49.6%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} + \left(-{\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}\right)} \]
  5. Step-by-step derivation
    1. unsub-neg99.6%

      \[\leadsto \color{blue}{{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}} \]
  6. Simplified99.6%

    \[\leadsto \color{blue}{{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}} \]
  7. Final simplification99.6%

    \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]

Alternative 3: 81.4% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-311}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 10^{+238}:\\ \;\;\;\;\frac{x \cdot x - t_0}{x \cdot x + t_0}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \frac{\frac{y}{x}}{\frac{x}{y}} \cdot -4\right) - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0))))
   (if (<= (* x x) 5e-311)
     -1.0
     (if (<= (* x x) 1e+238)
       (/ (- (* x x) t_0) (+ (* x x) t_0))
       (-
        (+ 1.0 (* (/ (/ y x) (/ x y)) -4.0))
        (pow (/ (* y 2.0) (hypot x (* y 2.0))) 2.0))))))
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double tmp;
	if ((x * x) <= 5e-311) {
		tmp = -1.0;
	} else if ((x * x) <= 1e+238) {
		tmp = ((x * x) - t_0) / ((x * x) + t_0);
	} else {
		tmp = (1.0 + (((y / x) / (x / y)) * -4.0)) - pow(((y * 2.0) / hypot(x, (y * 2.0))), 2.0);
	}
	return tmp;
}
public static double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double tmp;
	if ((x * x) <= 5e-311) {
		tmp = -1.0;
	} else if ((x * x) <= 1e+238) {
		tmp = ((x * x) - t_0) / ((x * x) + t_0);
	} else {
		tmp = (1.0 + (((y / x) / (x / y)) * -4.0)) - Math.pow(((y * 2.0) / Math.hypot(x, (y * 2.0))), 2.0);
	}
	return tmp;
}
def code(x, y):
	t_0 = y * (y * 4.0)
	tmp = 0
	if (x * x) <= 5e-311:
		tmp = -1.0
	elif (x * x) <= 1e+238:
		tmp = ((x * x) - t_0) / ((x * x) + t_0)
	else:
		tmp = (1.0 + (((y / x) / (x / y)) * -4.0)) - math.pow(((y * 2.0) / math.hypot(x, (y * 2.0))), 2.0)
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	tmp = 0.0
	if (Float64(x * x) <= 5e-311)
		tmp = -1.0;
	elseif (Float64(x * x) <= 1e+238)
		tmp = Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0));
	else
		tmp = Float64(Float64(1.0 + Float64(Float64(Float64(y / x) / Float64(x / y)) * -4.0)) - (Float64(Float64(y * 2.0) / hypot(x, Float64(y * 2.0))) ^ 2.0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * (y * 4.0);
	tmp = 0.0;
	if ((x * x) <= 5e-311)
		tmp = -1.0;
	elseif ((x * x) <= 1e+238)
		tmp = ((x * x) - t_0) / ((x * x) + t_0);
	else
		tmp = (1.0 + (((y / x) / (x / y)) * -4.0)) - (((y * 2.0) / hypot(x, (y * 2.0))) ^ 2.0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e-311], -1.0, If[LessEqual[N[(x * x), $MachinePrecision], 1e+238], N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(y / x), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] - N[Power[N[(N[(y * 2.0), $MachinePrecision] / N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-311}:\\
\;\;\;\;-1\\

\mathbf{elif}\;x \cdot x \leq 10^{+238}:\\
\;\;\;\;\frac{x \cdot x - t_0}{x \cdot x + t_0}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 5.00000000000023e-311

    1. Initial program 45.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 96.1%

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

    if 5.00000000000023e-311 < (*.f64 x x) < 1e238

    1. Initial program 78.3%

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

    if 1e238 < (*.f64 x x)

    1. Initial program 11.8%

      \[\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. div-sub11.8%

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

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

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

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

        \[\leadsto \frac{x \cdot x}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)} - \frac{y \cdot \left(y \cdot 4\right)}{\color{blue}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}} \]
      6. *-commutative11.8%

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

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

      \[\leadsto \color{blue}{{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} + \left(-{\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}\right)} \]
    5. Step-by-step derivation
      1. unsub-neg100.0%

        \[\leadsto \color{blue}{{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}} \]
    6. Simplified100.0%

      \[\leadsto \color{blue}{{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}} \]
    7. Taylor expanded in x around inf 73.1%

      \[\leadsto \color{blue}{\left(1 + -4 \cdot \frac{{y}^{2}}{{x}^{2}}\right)} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    8. Step-by-step derivation
      1. *-commutative73.1%

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

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

        \[\leadsto \left(1 + \frac{\color{blue}{y \cdot y}}{x \cdot x} \cdot -4\right) - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
      4. times-frac83.7%

        \[\leadsto \left(1 + \color{blue}{\left(\frac{y}{x} \cdot \frac{y}{x}\right)} \cdot -4\right) - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
      5. unpow283.7%

        \[\leadsto \left(1 + \color{blue}{{\left(\frac{y}{x}\right)}^{2}} \cdot -4\right) - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    9. Simplified83.7%

      \[\leadsto \color{blue}{\left(1 + {\left(\frac{y}{x}\right)}^{2} \cdot -4\right)} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} \]
    10. Step-by-step derivation
      1. unpow283.6%

        \[\leadsto 1 + -8 \cdot \color{blue}{\left(\frac{y}{x} \cdot \frac{y}{x}\right)} \]
      2. clear-num83.6%

        \[\leadsto 1 + -8 \cdot \left(\frac{y}{x} \cdot \color{blue}{\frac{1}{\frac{x}{y}}}\right) \]
      3. un-div-inv83.6%

        \[\leadsto 1 + -8 \cdot \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \]
    11. Applied egg-rr83.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-311}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 10^{+238}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \frac{\frac{y}{x}}{\frac{x}{y}} \cdot -4\right) - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}\\ \end{array} \]

Alternative 4: 81.4% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \frac{y}{x}\\ t_1 := y \cdot \left(y \cdot 4\right)\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-311}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 10^{+238}:\\ \;\;\;\;\frac{x \cdot x - t_1}{x \cdot x + t_1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - t_0 \cdot t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* 2.0 (/ y x))) (t_1 (* y (* y 4.0))))
   (if (<= (* x x) 5e-311)
     -1.0
     (if (<= (* x x) 1e+238)
       (/ (- (* x x) t_1) (+ (* x x) t_1))
       (- (pow (/ x (hypot x (* y 2.0))) 2.0) (* t_0 t_0))))))
double code(double x, double y) {
	double t_0 = 2.0 * (y / x);
	double t_1 = y * (y * 4.0);
	double tmp;
	if ((x * x) <= 5e-311) {
		tmp = -1.0;
	} else if ((x * x) <= 1e+238) {
		tmp = ((x * x) - t_1) / ((x * x) + t_1);
	} else {
		tmp = pow((x / hypot(x, (y * 2.0))), 2.0) - (t_0 * t_0);
	}
	return tmp;
}
public static double code(double x, double y) {
	double t_0 = 2.0 * (y / x);
	double t_1 = y * (y * 4.0);
	double tmp;
	if ((x * x) <= 5e-311) {
		tmp = -1.0;
	} else if ((x * x) <= 1e+238) {
		tmp = ((x * x) - t_1) / ((x * x) + t_1);
	} else {
		tmp = Math.pow((x / Math.hypot(x, (y * 2.0))), 2.0) - (t_0 * t_0);
	}
	return tmp;
}
def code(x, y):
	t_0 = 2.0 * (y / x)
	t_1 = y * (y * 4.0)
	tmp = 0
	if (x * x) <= 5e-311:
		tmp = -1.0
	elif (x * x) <= 1e+238:
		tmp = ((x * x) - t_1) / ((x * x) + t_1)
	else:
		tmp = math.pow((x / math.hypot(x, (y * 2.0))), 2.0) - (t_0 * t_0)
	return tmp
function code(x, y)
	t_0 = Float64(2.0 * Float64(y / x))
	t_1 = Float64(y * Float64(y * 4.0))
	tmp = 0.0
	if (Float64(x * x) <= 5e-311)
		tmp = -1.0;
	elseif (Float64(x * x) <= 1e+238)
		tmp = Float64(Float64(Float64(x * x) - t_1) / Float64(Float64(x * x) + t_1));
	else
		tmp = Float64((Float64(x / hypot(x, Float64(y * 2.0))) ^ 2.0) - Float64(t_0 * t_0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 2.0 * (y / x);
	t_1 = y * (y * 4.0);
	tmp = 0.0;
	if ((x * x) <= 5e-311)
		tmp = -1.0;
	elseif ((x * x) <= 1e+238)
		tmp = ((x * x) - t_1) / ((x * x) + t_1);
	else
		tmp = ((x / hypot(x, (y * 2.0))) ^ 2.0) - (t_0 * t_0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(2.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e-311], -1.0, If[LessEqual[N[(x * x), $MachinePrecision], 1e+238], N[(N[(N[(x * x), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(x / N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \cdot x \leq 10^{+238}:\\
\;\;\;\;\frac{x \cdot x - t_1}{x \cdot x + t_1}\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - t_0 \cdot t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 5.00000000000023e-311

    1. Initial program 45.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 96.1%

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

    if 5.00000000000023e-311 < (*.f64 x x) < 1e238

    1. Initial program 78.3%

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

    if 1e238 < (*.f64 x x)

    1. Initial program 11.8%

      \[\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. div-sub11.8%

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

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

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

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

        \[\leadsto \frac{x \cdot x}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)} - \frac{y \cdot \left(y \cdot 4\right)}{\color{blue}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}} \]
      6. *-commutative11.8%

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

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

      \[\leadsto \color{blue}{{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} + \left(-{\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}\right)} \]
    5. Step-by-step derivation
      1. unsub-neg100.0%

        \[\leadsto \color{blue}{{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}} \]
    6. Simplified100.0%

      \[\leadsto \color{blue}{{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\left(\frac{y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2}} \]
    7. Taylor expanded in y around 0 83.6%

      \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\color{blue}{\left(2 \cdot \frac{y}{x}\right)}}^{2} \]
    8. Step-by-step derivation
      1. associate-*r/83.6%

        \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\color{blue}{\left(\frac{2 \cdot y}{x}\right)}}^{2} \]
      2. count-283.6%

        \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\left(\frac{\color{blue}{y + y}}{x}\right)}^{2} \]
    9. Simplified83.6%

      \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - {\color{blue}{\left(\frac{y + y}{x}\right)}}^{2} \]
    10. Step-by-step derivation
      1. unpow283.6%

        \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - \color{blue}{\frac{y + y}{x} \cdot \frac{y + y}{x}} \]
      2. count-283.6%

        \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - \frac{\color{blue}{2 \cdot y}}{x} \cdot \frac{y + y}{x} \]
      3. *-un-lft-identity83.6%

        \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - \frac{2 \cdot y}{\color{blue}{1 \cdot x}} \cdot \frac{y + y}{x} \]
      4. times-frac83.6%

        \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - \color{blue}{\left(\frac{2}{1} \cdot \frac{y}{x}\right)} \cdot \frac{y + y}{x} \]
      5. metadata-eval83.6%

        \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - \left(\color{blue}{2} \cdot \frac{y}{x}\right) \cdot \frac{y + y}{x} \]
      6. count-283.6%

        \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - \left(2 \cdot \frac{y}{x}\right) \cdot \frac{\color{blue}{2 \cdot y}}{x} \]
      7. *-un-lft-identity83.6%

        \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - \left(2 \cdot \frac{y}{x}\right) \cdot \frac{2 \cdot y}{\color{blue}{1 \cdot x}} \]
      8. times-frac83.6%

        \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - \left(2 \cdot \frac{y}{x}\right) \cdot \color{blue}{\left(\frac{2}{1} \cdot \frac{y}{x}\right)} \]
      9. metadata-eval83.6%

        \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - \left(2 \cdot \frac{y}{x}\right) \cdot \left(\color{blue}{2} \cdot \frac{y}{x}\right) \]
    11. Applied egg-rr83.6%

      \[\leadsto {\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - \color{blue}{\left(2 \cdot \frac{y}{x}\right) \cdot \left(2 \cdot \frac{y}{x}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification83.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-311}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 10^{+238}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x}{\mathsf{hypot}\left(x, y \cdot 2\right)}\right)}^{2} - \left(2 \cdot \frac{y}{x}\right) \cdot \left(2 \cdot \frac{y}{x}\right)\\ \end{array} \]

Alternative 5: 72.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ \mathbf{if}\;t_0 \leq 5 \cdot 10^{+118} \lor \neg \left(t_0 \leq 2 \cdot 10^{+209}\right) \land t_0 \leq 2 \cdot 10^{+279}:\\ \;\;\;\;1 + \frac{\frac{y}{x}}{\frac{x}{y}} \cdot -8\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0))))
   (if (or (<= t_0 5e+118) (and (not (<= t_0 2e+209)) (<= t_0 2e+279)))
     (+ 1.0 (* (/ (/ y x) (/ x y)) -8.0))
     -1.0)))
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double tmp;
	if ((t_0 <= 5e+118) || (!(t_0 <= 2e+209) && (t_0 <= 2e+279))) {
		tmp = 1.0 + (((y / x) / (x / y)) * -8.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) :: t_0
    real(8) :: tmp
    t_0 = y * (y * 4.0d0)
    if ((t_0 <= 5d+118) .or. (.not. (t_0 <= 2d+209)) .and. (t_0 <= 2d+279)) then
        tmp = 1.0d0 + (((y / x) / (x / y)) * (-8.0d0))
    else
        tmp = -1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double tmp;
	if ((t_0 <= 5e+118) || (!(t_0 <= 2e+209) && (t_0 <= 2e+279))) {
		tmp = 1.0 + (((y / x) / (x / y)) * -8.0);
	} else {
		tmp = -1.0;
	}
	return tmp;
}
def code(x, y):
	t_0 = y * (y * 4.0)
	tmp = 0
	if (t_0 <= 5e+118) or (not (t_0 <= 2e+209) and (t_0 <= 2e+279)):
		tmp = 1.0 + (((y / x) / (x / y)) * -8.0)
	else:
		tmp = -1.0
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	tmp = 0.0
	if ((t_0 <= 5e+118) || (!(t_0 <= 2e+209) && (t_0 <= 2e+279)))
		tmp = Float64(1.0 + Float64(Float64(Float64(y / x) / Float64(x / y)) * -8.0));
	else
		tmp = -1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * (y * 4.0);
	tmp = 0.0;
	if ((t_0 <= 5e+118) || (~((t_0 <= 2e+209)) && (t_0 <= 2e+279)))
		tmp = 1.0 + (((y / x) / (x / y)) * -8.0);
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 5e+118], And[N[Not[LessEqual[t$95$0, 2e+209]], $MachinePrecision], LessEqual[t$95$0, 2e+279]]], N[(1.0 + N[(N[(N[(y / x), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision] * -8.0), $MachinePrecision]), $MachinePrecision], -1.0]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{+118} \lor \neg \left(t_0 \leq 2 \cdot 10^{+209}\right) \land t_0 \leq 2 \cdot 10^{+279}:\\
\;\;\;\;1 + \frac{\frac{y}{x}}{\frac{x}{y}} \cdot -8\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 y 4) y) < 4.99999999999999972e118 or 2.0000000000000001e209 < (*.f64 (*.f64 y 4) y) < 2.00000000000000012e279

    1. Initial program 64.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 inf 74.2%

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

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

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

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

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

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

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

        \[\leadsto 1 + \left(\frac{y \cdot \left(y \cdot -4\right)}{x \cdot x} - 4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}}\right) \]
      8. associate-*r/74.2%

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

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

        \[\leadsto 1 + \left(\frac{y \cdot \left(y \cdot -4\right)}{x \cdot x} - \frac{\color{blue}{\left(y \cdot y\right)} \cdot 4}{x \cdot x}\right) \]
      11. associate-*r*74.2%

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

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

      \[\leadsto 1 + \color{blue}{-8 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    6. Step-by-step derivation
      1. unpow274.2%

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

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

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

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

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

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

        \[\leadsto 1 + -8 \cdot \left(\frac{y}{x} \cdot \color{blue}{\frac{1}{\frac{x}{y}}}\right) \]
      3. un-div-inv75.7%

        \[\leadsto 1 + -8 \cdot \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \]
    9. Applied egg-rr75.7%

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

    if 4.99999999999999972e118 < (*.f64 (*.f64 y 4) y) < 2.0000000000000001e209 or 2.00000000000000012e279 < (*.f64 (*.f64 y 4) y)

    1. Initial program 23.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 5 \cdot 10^{+118} \lor \neg \left(y \cdot \left(y \cdot 4\right) \leq 2 \cdot 10^{+209}\right) \land y \cdot \left(y \cdot 4\right) \leq 2 \cdot 10^{+279}:\\ \;\;\;\;1 + \frac{\frac{y}{x}}{\frac{x}{y}} \cdot -8\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]

Alternative 6: 72.7% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+209}:\\
\;\;\;\;\frac{y \cdot \left(y \cdot -4\right)}{x \cdot x + t_0}\\

\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+279}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y 4) y) < 4.99999999999999972e118 or 2.0000000000000001e209 < (*.f64 (*.f64 y 4) y) < 2.00000000000000012e279

    1. Initial program 64.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 inf 74.2%

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

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

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

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

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

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

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

        \[\leadsto 1 + \left(\frac{y \cdot \left(y \cdot -4\right)}{x \cdot x} - 4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}}\right) \]
      8. associate-*r/74.2%

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

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

        \[\leadsto 1 + \left(\frac{y \cdot \left(y \cdot -4\right)}{x \cdot x} - \frac{\color{blue}{\left(y \cdot y\right)} \cdot 4}{x \cdot x}\right) \]
      11. associate-*r*74.2%

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

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

      \[\leadsto 1 + \color{blue}{-8 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    6. Step-by-step derivation
      1. unpow274.2%

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

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

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

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

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

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

        \[\leadsto 1 + -8 \cdot \left(\frac{y}{x} \cdot \color{blue}{\frac{1}{\frac{x}{y}}}\right) \]
      3. un-div-inv75.7%

        \[\leadsto 1 + -8 \cdot \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \]
    9. Applied egg-rr75.7%

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

    if 4.99999999999999972e118 < (*.f64 (*.f64 y 4) y) < 2.0000000000000001e209

    1. Initial program 86.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 73.4%

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

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

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

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

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

    if 2.00000000000000012e279 < (*.f64 (*.f64 y 4) y)

    1. Initial program 4.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 0 86.1%

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

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

Alternative 7: 81.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ \mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-311}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \cdot x \leq 10^{+238}:\\ \;\;\;\;\frac{x \cdot x - t_0}{x \cdot x + t_0}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{y}{x}}{\frac{x}{y}} \cdot -8\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0))))
   (if (<= (* x x) 5e-311)
     -1.0
     (if (<= (* x x) 1e+238)
       (/ (- (* x x) t_0) (+ (* x x) t_0))
       (+ 1.0 (* (/ (/ y x) (/ x y)) -8.0))))))
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double tmp;
	if ((x * x) <= 5e-311) {
		tmp = -1.0;
	} else if ((x * x) <= 1e+238) {
		tmp = ((x * x) - t_0) / ((x * x) + t_0);
	} else {
		tmp = 1.0 + (((y / x) / (x / y)) * -8.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) :: tmp
    t_0 = y * (y * 4.0d0)
    if ((x * x) <= 5d-311) then
        tmp = -1.0d0
    else if ((x * x) <= 1d+238) then
        tmp = ((x * x) - t_0) / ((x * x) + t_0)
    else
        tmp = 1.0d0 + (((y / x) / (x / y)) * (-8.0d0))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double tmp;
	if ((x * x) <= 5e-311) {
		tmp = -1.0;
	} else if ((x * x) <= 1e+238) {
		tmp = ((x * x) - t_0) / ((x * x) + t_0);
	} else {
		tmp = 1.0 + (((y / x) / (x / y)) * -8.0);
	}
	return tmp;
}
def code(x, y):
	t_0 = y * (y * 4.0)
	tmp = 0
	if (x * x) <= 5e-311:
		tmp = -1.0
	elif (x * x) <= 1e+238:
		tmp = ((x * x) - t_0) / ((x * x) + t_0)
	else:
		tmp = 1.0 + (((y / x) / (x / y)) * -8.0)
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	tmp = 0.0
	if (Float64(x * x) <= 5e-311)
		tmp = -1.0;
	elseif (Float64(x * x) <= 1e+238)
		tmp = Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0));
	else
		tmp = Float64(1.0 + Float64(Float64(Float64(y / x) / Float64(x / y)) * -8.0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * (y * 4.0);
	tmp = 0.0;
	if ((x * x) <= 5e-311)
		tmp = -1.0;
	elseif ((x * x) <= 1e+238)
		tmp = ((x * x) - t_0) / ((x * x) + t_0);
	else
		tmp = 1.0 + (((y / x) / (x / y)) * -8.0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e-311], -1.0, If[LessEqual[N[(x * x), $MachinePrecision], 1e+238], N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[(y / x), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision] * -8.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-311}:\\
\;\;\;\;-1\\

\mathbf{elif}\;x \cdot x \leq 10^{+238}:\\
\;\;\;\;\frac{x \cdot x - t_0}{x \cdot x + t_0}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 5.00000000000023e-311

    1. Initial program 45.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 96.1%

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

    if 5.00000000000023e-311 < (*.f64 x x) < 1e238

    1. Initial program 78.3%

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

    if 1e238 < (*.f64 x x)

    1. Initial program 11.8%

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

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

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

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

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

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

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

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

        \[\leadsto 1 + \left(\frac{y \cdot \left(y \cdot -4\right)}{x \cdot x} - 4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}}\right) \]
      8. associate-*r/73.1%

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

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

        \[\leadsto 1 + \left(\frac{y \cdot \left(y \cdot -4\right)}{x \cdot x} - \frac{\color{blue}{\left(y \cdot y\right)} \cdot 4}{x \cdot x}\right) \]
      11. associate-*r*73.1%

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

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

      \[\leadsto 1 + \color{blue}{-8 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    6. Step-by-step derivation
      1. unpow273.1%

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

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

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

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

      \[\leadsto 1 + \color{blue}{-8 \cdot {\left(\frac{y}{x}\right)}^{2}} \]
    8. Step-by-step derivation
      1. unpow283.6%

        \[\leadsto 1 + -8 \cdot \color{blue}{\left(\frac{y}{x} \cdot \frac{y}{x}\right)} \]
      2. clear-num83.6%

        \[\leadsto 1 + -8 \cdot \left(\frac{y}{x} \cdot \color{blue}{\frac{1}{\frac{x}{y}}}\right) \]
      3. un-div-inv83.6%

        \[\leadsto 1 + -8 \cdot \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \]
    9. Applied egg-rr83.6%

      \[\leadsto 1 + -8 \cdot \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification83.6%

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

Alternative 8: 61.6% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 4.7 \cdot 10^{+60}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 5.3 \cdot 10^{+106}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+139}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 4.7e+60)
   1.0
   (if (<= y 5.3e+106) -1.0 (if (<= y 2.2e+139) 1.0 -1.0))))
double code(double x, double y) {
	double tmp;
	if (y <= 4.7e+60) {
		tmp = 1.0;
	} else if (y <= 5.3e+106) {
		tmp = -1.0;
	} else if (y <= 2.2e+139) {
		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 <= 4.7d+60) then
        tmp = 1.0d0
    else if (y <= 5.3d+106) then
        tmp = -1.0d0
    else if (y <= 2.2d+139) 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 <= 4.7e+60) {
		tmp = 1.0;
	} else if (y <= 5.3e+106) {
		tmp = -1.0;
	} else if (y <= 2.2e+139) {
		tmp = 1.0;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 4.7e+60:
		tmp = 1.0
	elif y <= 5.3e+106:
		tmp = -1.0
	elif y <= 2.2e+139:
		tmp = 1.0
	else:
		tmp = -1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 4.7e+60)
		tmp = 1.0;
	elseif (y <= 5.3e+106)
		tmp = -1.0;
	elseif (y <= 2.2e+139)
		tmp = 1.0;
	else
		tmp = -1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 4.7e+60)
		tmp = 1.0;
	elseif (y <= 5.3e+106)
		tmp = -1.0;
	elseif (y <= 2.2e+139)
		tmp = 1.0;
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 4.7e+60], 1.0, If[LessEqual[y, 5.3e+106], -1.0, If[LessEqual[y, 2.2e+139], 1.0, -1.0]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.7 \cdot 10^{+60}:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq 5.3 \cdot 10^{+106}:\\
\;\;\;\;-1\\

\mathbf{elif}\;y \leq 2.2 \cdot 10^{+139}:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 4.6999999999999998e60 or 5.3e106 < y < 2.1999999999999999e139

    1. Initial program 55.8%

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

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

    if 4.6999999999999998e60 < y < 5.3e106 or 2.1999999999999999e139 < y

    1. Initial program 24.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.7 \cdot 10^{+60}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 5.3 \cdot 10^{+106}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{+139}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]

Alternative 9: 50.0% 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 49.6%

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

    \[\leadsto \color{blue}{-1} \]
  3. Final simplification46.4%

    \[\leadsto -1 \]

Developer target: 50.7% 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 2023293 
(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))))