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

Percentage Accurate: 51.5% → 99.9%
Time: 6.5s
Alternatives: 9
Speedup: 6.2×

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: 51.5% 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} x = |x|\\ y = |y|\\ \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\ \frac{\mathsf{fma}\left(y, 2, x\right) \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{t_0}}{t_0} \end{array} \end{array} \]
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (hypot x (* y 2.0))))
   (/ (* (fma y 2.0 x) (/ (fma y -2.0 x) t_0)) t_0)))
x = abs(x);
y = abs(y);
double code(double x, double y) {
	double t_0 = hypot(x, (y * 2.0));
	return (fma(y, 2.0, x) * (fma(y, -2.0, x) / t_0)) / t_0;
}
x = abs(x)
y = abs(y)
function code(x, y)
	t_0 = hypot(x, Float64(y * 2.0))
	return Float64(Float64(fma(y, 2.0, x) * Float64(fma(y, -2.0, x) / t_0)) / t_0)
end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[(N[(y * 2.0 + x), $MachinePrecision] * N[(N[(y * -2.0 + x), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\frac{\mathsf{fma}\left(y, 2, x\right) \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{t_0}}{t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 48.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. add-sqr-sqrt48.8%

      \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. difference-of-squares48.8%

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

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

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

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

      \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    7. add-sqr-sqrt34.8%

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

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

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

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

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    12. sqrt-unprod23.3%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    13. add-sqr-sqrt48.8%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    14. metadata-eval48.8%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
  3. Applied egg-rr48.8%

    \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
  4. Step-by-step derivation
    1. add-sqr-sqrt48.8%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
    2. times-frac50.0%

      \[\leadsto \color{blue}{\frac{x + y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
    3. +-commutative50.0%

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    5. add-sqr-sqrt50.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. hypot-def50.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    7. *-commutative50.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    8. associate-*r*50.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    9. metadata-eval50.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(2 \cdot 2\right)}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    10. swap-sqr50.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{\left(y \cdot 2\right) \cdot \left(y \cdot 2\right)}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    11. sqrt-unprod24.2%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 2} \cdot \sqrt{y \cdot 2}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    12. add-sqr-sqrt50.0%

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

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
  6. Step-by-step derivation
    1. associate-*l/100.0%

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

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right) \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
  8. Final simplification100.0%

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

Alternative 2: 99.9% accurate, 0.0× speedup?

\[\begin{array}{l} x = |x|\\ y = |y|\\ \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\ \frac{\mathsf{fma}\left(y, -2, x\right)}{t_0} \cdot \frac{\mathsf{fma}\left(y, 2, x\right)}{t_0} \end{array} \end{array} \]
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (hypot x (* y 2.0))))
   (* (/ (fma y -2.0 x) t_0) (/ (fma y 2.0 x) t_0))))
x = abs(x);
y = abs(y);
double code(double x, double y) {
	double t_0 = hypot(x, (y * 2.0));
	return (fma(y, -2.0, x) / t_0) * (fma(y, 2.0, x) / t_0);
}
x = abs(x)
y = abs(y)
function code(x, y)
	t_0 = hypot(x, Float64(y * 2.0))
	return Float64(Float64(fma(y, -2.0, x) / t_0) * Float64(fma(y, 2.0, x) / t_0))
end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[(N[(y * -2.0 + x), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[(y * 2.0 + x), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\frac{\mathsf{fma}\left(y, -2, x\right)}{t_0} \cdot \frac{\mathsf{fma}\left(y, 2, x\right)}{t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 48.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. add-sqr-sqrt48.8%

      \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. difference-of-squares48.8%

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

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

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

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

      \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    7. add-sqr-sqrt34.8%

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

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

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

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

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    12. sqrt-unprod23.3%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    13. add-sqr-sqrt48.8%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    14. metadata-eval48.8%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
  3. Applied egg-rr48.8%

    \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
  4. Step-by-step derivation
    1. add-sqr-sqrt48.8%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
    2. times-frac50.0%

      \[\leadsto \color{blue}{\frac{x + y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
    3. +-commutative50.0%

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    5. add-sqr-sqrt50.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. hypot-def50.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    7. *-commutative50.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    8. associate-*r*50.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    9. metadata-eval50.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(2 \cdot 2\right)}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    10. swap-sqr50.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{\left(y \cdot 2\right) \cdot \left(y \cdot 2\right)}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    11. sqrt-unprod24.2%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 2} \cdot \sqrt{y \cdot 2}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    12. add-sqr-sqrt50.0%

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

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

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

Alternative 3: 79.3% accurate, 0.1× speedup?

\[\begin{array}{l} x = |x|\\ y = |y|\\ \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(y, -2, \left(x \cdot \frac{x}{y}\right) \cdot 0.75\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}\\ t_1 := y \cdot \left(y \cdot 4\right)\\ t_2 := \frac{x \cdot x - t_1}{x \cdot x + t_1}\\ \mathbf{if}\;x \cdot x \leq 10^{-155}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-102}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-50}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot x \leq 10^{+28}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+81}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+250}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;1 - \left(\frac{y}{x} \cdot \frac{y}{x}\right) \cdot 8\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (fma y -2.0 (* (* x (/ x y)) 0.75)) (hypot x (* y 2.0))))
        (t_1 (* y (* y 4.0)))
        (t_2 (/ (- (* x x) t_1) (+ (* x x) t_1))))
   (if (<= (* x x) 1e-155)
     t_0
     (if (<= (* x x) 2e-102)
       t_2
       (if (<= (* x x) 5e-50)
         t_0
         (if (<= (* x x) 1e+28)
           t_2
           (if (<= (* x x) 5e+81)
             t_0
             (if (<= (* x x) 5e+250)
               t_2
               (- 1.0 (* (* (/ y x) (/ y x)) 8.0))))))))))
x = abs(x);
y = abs(y);
double code(double x, double y) {
	double t_0 = fma(y, -2.0, ((x * (x / y)) * 0.75)) / hypot(x, (y * 2.0));
	double t_1 = y * (y * 4.0);
	double t_2 = ((x * x) - t_1) / ((x * x) + t_1);
	double tmp;
	if ((x * x) <= 1e-155) {
		tmp = t_0;
	} else if ((x * x) <= 2e-102) {
		tmp = t_2;
	} else if ((x * x) <= 5e-50) {
		tmp = t_0;
	} else if ((x * x) <= 1e+28) {
		tmp = t_2;
	} else if ((x * x) <= 5e+81) {
		tmp = t_0;
	} else if ((x * x) <= 5e+250) {
		tmp = t_2;
	} else {
		tmp = 1.0 - (((y / x) * (y / x)) * 8.0);
	}
	return tmp;
}
x = abs(x)
y = abs(y)
function code(x, y)
	t_0 = Float64(fma(y, -2.0, Float64(Float64(x * Float64(x / y)) * 0.75)) / hypot(x, Float64(y * 2.0)))
	t_1 = Float64(y * Float64(y * 4.0))
	t_2 = Float64(Float64(Float64(x * x) - t_1) / Float64(Float64(x * x) + t_1))
	tmp = 0.0
	if (Float64(x * x) <= 1e-155)
		tmp = t_0;
	elseif (Float64(x * x) <= 2e-102)
		tmp = t_2;
	elseif (Float64(x * x) <= 5e-50)
		tmp = t_0;
	elseif (Float64(x * x) <= 1e+28)
		tmp = t_2;
	elseif (Float64(x * x) <= 5e+81)
		tmp = t_0;
	elseif (Float64(x * x) <= 5e+250)
		tmp = t_2;
	else
		tmp = Float64(1.0 - Float64(Float64(Float64(y / x) * Float64(y / x)) * 8.0));
	end
	return tmp
end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[(N[(y * -2.0 + N[(N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision] * 0.75), $MachinePrecision]), $MachinePrecision] / N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $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[(N[(x * x), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 1e-155], t$95$0, If[LessEqual[N[(x * x), $MachinePrecision], 2e-102], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 5e-50], t$95$0, If[LessEqual[N[(x * x), $MachinePrecision], 1e+28], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 5e+81], t$95$0, If[LessEqual[N[(x * x), $MachinePrecision], 5e+250], t$95$2, N[(1.0 - N[(N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] * 8.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(y, -2, \left(x \cdot \frac{x}{y}\right) \cdot 0.75\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}\\
t_1 := y \cdot \left(y \cdot 4\right)\\
t_2 := \frac{x \cdot x - t_1}{x \cdot x + t_1}\\
\mathbf{if}\;x \cdot x \leq 10^{-155}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-50}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+81}:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 1.00000000000000001e-155 or 1.99999999999999987e-102 < (*.f64 x x) < 4.99999999999999968e-50 or 9.99999999999999958e27 < (*.f64 x x) < 4.9999999999999998e81

    1. Initial program 54.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. add-sqr-sqrt54.6%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares54.6%

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

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

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt31.1%

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

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

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

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt54.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval54.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    3. Applied egg-rr54.6%

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt54.6%

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt55.2%

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. *-commutative55.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. associate-*r*55.1%

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(2 \cdot 2\right)}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. swap-sqr55.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{\left(y \cdot 2\right) \cdot \left(y \cdot 2\right)}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. sqrt-unprod24.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 2} \cdot \sqrt{y \cdot 2}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt55.2%

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    6. Step-by-step derivation
      1. associate-*l/100.0%

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

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

      \[\leadsto \frac{\color{blue}{\left(-2 \cdot y + \left(0.5 \cdot \left(2 \cdot x + -2 \cdot x\right) + 0.5 \cdot \frac{{x}^{2}}{y}\right)\right) - -0.25 \cdot \frac{{x}^{2}}{y}}}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    9. Step-by-step derivation
      1. associate--l+41.1%

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, -2, \color{blue}{\left(0.5 \cdot \frac{{x}^{2}}{y} + 0.5 \cdot \left(2 \cdot x + -2 \cdot x\right)\right)} - -0.25 \cdot \frac{{x}^{2}}{y}\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      5. distribute-rgt-out41.1%

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

        \[\leadsto \frac{\mathsf{fma}\left(y, -2, \left(0.5 \cdot \frac{{x}^{2}}{y} + 0.5 \cdot \left(x \cdot \color{blue}{0}\right)\right) - -0.25 \cdot \frac{{x}^{2}}{y}\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      7. mul0-rgt41.1%

        \[\leadsto \frac{\mathsf{fma}\left(y, -2, \left(0.5 \cdot \frac{{x}^{2}}{y} + 0.5 \cdot \color{blue}{0}\right) - -0.25 \cdot \frac{{x}^{2}}{y}\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      8. metadata-eval41.1%

        \[\leadsto \frac{\mathsf{fma}\left(y, -2, \left(0.5 \cdot \frac{{x}^{2}}{y} + \color{blue}{0}\right) - -0.25 \cdot \frac{{x}^{2}}{y}\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      9. associate--l+41.1%

        \[\leadsto \frac{\mathsf{fma}\left(y, -2, \color{blue}{0.5 \cdot \frac{{x}^{2}}{y} + \left(0 - -0.25 \cdot \frac{{x}^{2}}{y}\right)}\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    10. Simplified41.5%

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

    if 1.00000000000000001e-155 < (*.f64 x x) < 1.99999999999999987e-102 or 4.99999999999999968e-50 < (*.f64 x x) < 9.99999999999999958e27 or 4.9999999999999998e81 < (*.f64 x x) < 5.0000000000000002e250

    1. Initial program 83.6%

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

    if 5.0000000000000002e250 < (*.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. add-sqr-sqrt11.8%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares11.8%

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

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

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt11.8%

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

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

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

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt11.8%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval11.8%

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

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Taylor expanded in x around -inf 80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 10^{-155}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, -2, \left(x \cdot \frac{x}{y}\right) \cdot 0.75\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-102}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-50}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, -2, \left(x \cdot \frac{x}{y}\right) \cdot 0.75\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}\\ \mathbf{elif}\;x \cdot x \leq 10^{+28}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+81}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, -2, \left(x \cdot \frac{x}{y}\right) \cdot 0.75\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+250}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \left(\frac{y}{x} \cdot \frac{y}{x}\right) \cdot 8\\ \end{array} \]

Alternative 4: 79.2% accurate, 0.1× speedup?

\[\begin{array}{l} x = |x|\\ y = |y|\\ \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\ t_2 := \mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \mathbf{if}\;x \cdot x \leq 10^{-155}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-102}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-50}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 10^{+28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+81}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+250}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;1 - \left(\frac{y}{x} \cdot \frac{y}{x}\right) \cdot 8\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0)))
        (t_1 (/ (- (* x x) t_0) (+ (* x x) t_0)))
        (t_2 (fma 0.5 (* (/ x y) (/ x y)) -1.0)))
   (if (<= (* x x) 1e-155)
     t_2
     (if (<= (* x x) 2e-102)
       t_1
       (if (<= (* x x) 5e-50)
         t_2
         (if (<= (* x x) 1e+28)
           t_1
           (if (<= (* x x) 5e+81)
             t_2
             (if (<= (* x x) 5e+250)
               t_1
               (- 1.0 (* (* (/ y x) (/ y x)) 8.0))))))))))
x = abs(x);
y = abs(y);
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = ((x * x) - t_0) / ((x * x) + t_0);
	double t_2 = fma(0.5, ((x / y) * (x / y)), -1.0);
	double tmp;
	if ((x * x) <= 1e-155) {
		tmp = t_2;
	} else if ((x * x) <= 2e-102) {
		tmp = t_1;
	} else if ((x * x) <= 5e-50) {
		tmp = t_2;
	} else if ((x * x) <= 1e+28) {
		tmp = t_1;
	} else if ((x * x) <= 5e+81) {
		tmp = t_2;
	} else if ((x * x) <= 5e+250) {
		tmp = t_1;
	} else {
		tmp = 1.0 - (((y / x) * (y / x)) * 8.0);
	}
	return tmp;
}
x = abs(x)
y = abs(y)
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	t_1 = Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0))
	t_2 = fma(0.5, Float64(Float64(x / y) * Float64(x / y)), -1.0)
	tmp = 0.0
	if (Float64(x * x) <= 1e-155)
		tmp = t_2;
	elseif (Float64(x * x) <= 2e-102)
		tmp = t_1;
	elseif (Float64(x * x) <= 5e-50)
		tmp = t_2;
	elseif (Float64(x * x) <= 1e+28)
		tmp = t_1;
	elseif (Float64(x * x) <= 5e+81)
		tmp = t_2;
	elseif (Float64(x * x) <= 5e+250)
		tmp = t_1;
	else
		tmp = Float64(1.0 - Float64(Float64(Float64(y / x) * Float64(y / x)) * 8.0));
	end
	return tmp
end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 1e-155], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 2e-102], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 5e-50], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 1e+28], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 5e+81], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 5e+250], t$95$1, N[(1.0 - N[(N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] * 8.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\
t_2 := \mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\mathbf{if}\;x \cdot x \leq 10^{-155}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-102}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \cdot x \leq 10^{+28}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+250}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 1.00000000000000001e-155 or 1.99999999999999987e-102 < (*.f64 x x) < 4.99999999999999968e-50 or 9.99999999999999958e27 < (*.f64 x x) < 4.9999999999999998e81

    1. Initial program 54.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 77.8%

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

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

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

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

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

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

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

    if 1.00000000000000001e-155 < (*.f64 x x) < 1.99999999999999987e-102 or 4.99999999999999968e-50 < (*.f64 x x) < 9.99999999999999958e27 or 4.9999999999999998e81 < (*.f64 x x) < 5.0000000000000002e250

    1. Initial program 83.6%

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

    if 5.0000000000000002e250 < (*.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. add-sqr-sqrt11.8%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares11.8%

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

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

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt11.8%

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

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

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

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt11.8%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval11.8%

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

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Taylor expanded in x around -inf 80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 10^{-155}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-102}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-50}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \mathbf{elif}\;x \cdot x \leq 10^{+28}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+81}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+250}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \left(\frac{y}{x} \cdot \frac{y}{x}\right) \cdot 8\\ \end{array} \]

Alternative 5: 78.7% accurate, 0.1× speedup?

\[\begin{array}{l} x = |x|\\ y = |y|\\ \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\ t_2 := \frac{y \cdot -2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\\ \mathbf{if}\;x \cdot x \leq 10^{-155}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-102}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{-50}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 10^{+28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+81}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+250}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;1 - \left(\frac{y}{x} \cdot \frac{y}{x}\right) \cdot 8\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0)))
        (t_1 (/ (- (* x x) t_0) (+ (* x x) t_0)))
        (t_2 (/ (* y -2.0) (hypot x (* y 2.0)))))
   (if (<= (* x x) 1e-155)
     t_2
     (if (<= (* x x) 2e-102)
       t_1
       (if (<= (* x x) 5e-50)
         t_2
         (if (<= (* x x) 1e+28)
           t_1
           (if (<= (* x x) 5e+81)
             t_2
             (if (<= (* x x) 5e+250)
               t_1
               (- 1.0 (* (* (/ y x) (/ y x)) 8.0))))))))))
x = abs(x);
y = abs(y);
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = ((x * x) - t_0) / ((x * x) + t_0);
	double t_2 = (y * -2.0) / hypot(x, (y * 2.0));
	double tmp;
	if ((x * x) <= 1e-155) {
		tmp = t_2;
	} else if ((x * x) <= 2e-102) {
		tmp = t_1;
	} else if ((x * x) <= 5e-50) {
		tmp = t_2;
	} else if ((x * x) <= 1e+28) {
		tmp = t_1;
	} else if ((x * x) <= 5e+81) {
		tmp = t_2;
	} else if ((x * x) <= 5e+250) {
		tmp = t_1;
	} else {
		tmp = 1.0 - (((y / x) * (y / x)) * 8.0);
	}
	return tmp;
}
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = ((x * x) - t_0) / ((x * x) + t_0);
	double t_2 = (y * -2.0) / Math.hypot(x, (y * 2.0));
	double tmp;
	if ((x * x) <= 1e-155) {
		tmp = t_2;
	} else if ((x * x) <= 2e-102) {
		tmp = t_1;
	} else if ((x * x) <= 5e-50) {
		tmp = t_2;
	} else if ((x * x) <= 1e+28) {
		tmp = t_1;
	} else if ((x * x) <= 5e+81) {
		tmp = t_2;
	} else if ((x * x) <= 5e+250) {
		tmp = t_1;
	} else {
		tmp = 1.0 - (((y / x) * (y / x)) * 8.0);
	}
	return tmp;
}
x = abs(x)
y = abs(y)
def code(x, y):
	t_0 = y * (y * 4.0)
	t_1 = ((x * x) - t_0) / ((x * x) + t_0)
	t_2 = (y * -2.0) / math.hypot(x, (y * 2.0))
	tmp = 0
	if (x * x) <= 1e-155:
		tmp = t_2
	elif (x * x) <= 2e-102:
		tmp = t_1
	elif (x * x) <= 5e-50:
		tmp = t_2
	elif (x * x) <= 1e+28:
		tmp = t_1
	elif (x * x) <= 5e+81:
		tmp = t_2
	elif (x * x) <= 5e+250:
		tmp = t_1
	else:
		tmp = 1.0 - (((y / x) * (y / x)) * 8.0)
	return tmp
x = abs(x)
y = abs(y)
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	t_1 = Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0))
	t_2 = Float64(Float64(y * -2.0) / hypot(x, Float64(y * 2.0)))
	tmp = 0.0
	if (Float64(x * x) <= 1e-155)
		tmp = t_2;
	elseif (Float64(x * x) <= 2e-102)
		tmp = t_1;
	elseif (Float64(x * x) <= 5e-50)
		tmp = t_2;
	elseif (Float64(x * x) <= 1e+28)
		tmp = t_1;
	elseif (Float64(x * x) <= 5e+81)
		tmp = t_2;
	elseif (Float64(x * x) <= 5e+250)
		tmp = t_1;
	else
		tmp = Float64(1.0 - Float64(Float64(Float64(y / x) * Float64(y / x)) * 8.0));
	end
	return tmp
end
x = abs(x)
y = abs(y)
function tmp_2 = code(x, y)
	t_0 = y * (y * 4.0);
	t_1 = ((x * x) - t_0) / ((x * x) + t_0);
	t_2 = (y * -2.0) / hypot(x, (y * 2.0));
	tmp = 0.0;
	if ((x * x) <= 1e-155)
		tmp = t_2;
	elseif ((x * x) <= 2e-102)
		tmp = t_1;
	elseif ((x * x) <= 5e-50)
		tmp = t_2;
	elseif ((x * x) <= 1e+28)
		tmp = t_1;
	elseif ((x * x) <= 5e+81)
		tmp = t_2;
	elseif ((x * x) <= 5e+250)
		tmp = t_1;
	else
		tmp = 1.0 - (((y / x) * (y / x)) * 8.0);
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * -2.0), $MachinePrecision] / N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 1e-155], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 2e-102], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 5e-50], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 1e+28], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 5e+81], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 5e+250], t$95$1, N[(1.0 - N[(N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] * 8.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\
t_2 := \frac{y \cdot -2}{\mathsf{hypot}\left(x, y \cdot 2\right)}\\
\mathbf{if}\;x \cdot x \leq 10^{-155}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-102}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \cdot x \leq 10^{+28}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+250}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 1.00000000000000001e-155 or 1.99999999999999987e-102 < (*.f64 x x) < 4.99999999999999968e-50 or 9.99999999999999958e27 < (*.f64 x x) < 4.9999999999999998e81

    1. Initial program 54.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. add-sqr-sqrt54.6%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares54.6%

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

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

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt31.1%

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

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

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

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt54.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval54.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    3. Applied egg-rr54.6%

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt54.6%

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

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt55.2%

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. *-commutative55.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. associate-*r*55.1%

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(2 \cdot 2\right)}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. swap-sqr55.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{\left(y \cdot 2\right) \cdot \left(y \cdot 2\right)}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. sqrt-unprod24.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 2} \cdot \sqrt{y \cdot 2}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt55.2%

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    6. Step-by-step derivation
      1. associate-*l/100.0%

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot y}}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    9. Step-by-step derivation
      1. *-commutative41.3%

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

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

    if 1.00000000000000001e-155 < (*.f64 x x) < 1.99999999999999987e-102 or 4.99999999999999968e-50 < (*.f64 x x) < 9.99999999999999958e27 or 4.9999999999999998e81 < (*.f64 x x) < 5.0000000000000002e250

    1. Initial program 83.6%

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

    if 5.0000000000000002e250 < (*.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. add-sqr-sqrt11.8%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares11.8%

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

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

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt11.8%

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

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

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

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt11.8%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval11.8%

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

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Taylor expanded in x around -inf 80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 78.4% accurate, 0.6× speedup?

\[\begin{array}{l} x = |x|\\ y = |y|\\ \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\ \mathbf{if}\;x \leq 3.1 \cdot 10^{-78}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{-51}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-24}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{+14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6 \cdot 10^{+40}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{+126}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;1 - \left(\frac{y}{x} \cdot \frac{y}{x}\right) \cdot 8\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0))) (t_1 (/ (- (* x x) t_0) (+ (* x x) t_0))))
   (if (<= x 3.1e-78)
     -1.0
     (if (<= x 4.4e-51)
       t_1
       (if (<= x 2.8e-24)
         -1.0
         (if (<= x 2.4e+14)
           t_1
           (if (<= x 6e+40)
             -1.0
             (if (<= x 6.8e+126)
               t_1
               (- 1.0 (* (* (/ y x) (/ y x)) 8.0))))))))))
x = abs(x);
y = abs(y);
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = ((x * x) - t_0) / ((x * x) + t_0);
	double tmp;
	if (x <= 3.1e-78) {
		tmp = -1.0;
	} else if (x <= 4.4e-51) {
		tmp = t_1;
	} else if (x <= 2.8e-24) {
		tmp = -1.0;
	} else if (x <= 2.4e+14) {
		tmp = t_1;
	} else if (x <= 6e+40) {
		tmp = -1.0;
	} else if (x <= 6.8e+126) {
		tmp = t_1;
	} else {
		tmp = 1.0 - (((y / x) * (y / x)) * 8.0);
	}
	return tmp;
}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
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 = ((x * x) - t_0) / ((x * x) + t_0)
    if (x <= 3.1d-78) then
        tmp = -1.0d0
    else if (x <= 4.4d-51) then
        tmp = t_1
    else if (x <= 2.8d-24) then
        tmp = -1.0d0
    else if (x <= 2.4d+14) then
        tmp = t_1
    else if (x <= 6d+40) then
        tmp = -1.0d0
    else if (x <= 6.8d+126) then
        tmp = t_1
    else
        tmp = 1.0d0 - (((y / x) * (y / x)) * 8.0d0)
    end if
    code = tmp
end function
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = ((x * x) - t_0) / ((x * x) + t_0);
	double tmp;
	if (x <= 3.1e-78) {
		tmp = -1.0;
	} else if (x <= 4.4e-51) {
		tmp = t_1;
	} else if (x <= 2.8e-24) {
		tmp = -1.0;
	} else if (x <= 2.4e+14) {
		tmp = t_1;
	} else if (x <= 6e+40) {
		tmp = -1.0;
	} else if (x <= 6.8e+126) {
		tmp = t_1;
	} else {
		tmp = 1.0 - (((y / x) * (y / x)) * 8.0);
	}
	return tmp;
}
x = abs(x)
y = abs(y)
def code(x, y):
	t_0 = y * (y * 4.0)
	t_1 = ((x * x) - t_0) / ((x * x) + t_0)
	tmp = 0
	if x <= 3.1e-78:
		tmp = -1.0
	elif x <= 4.4e-51:
		tmp = t_1
	elif x <= 2.8e-24:
		tmp = -1.0
	elif x <= 2.4e+14:
		tmp = t_1
	elif x <= 6e+40:
		tmp = -1.0
	elif x <= 6.8e+126:
		tmp = t_1
	else:
		tmp = 1.0 - (((y / x) * (y / x)) * 8.0)
	return tmp
x = abs(x)
y = abs(y)
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	t_1 = Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0))
	tmp = 0.0
	if (x <= 3.1e-78)
		tmp = -1.0;
	elseif (x <= 4.4e-51)
		tmp = t_1;
	elseif (x <= 2.8e-24)
		tmp = -1.0;
	elseif (x <= 2.4e+14)
		tmp = t_1;
	elseif (x <= 6e+40)
		tmp = -1.0;
	elseif (x <= 6.8e+126)
		tmp = t_1;
	else
		tmp = Float64(1.0 - Float64(Float64(Float64(y / x) * Float64(y / x)) * 8.0));
	end
	return tmp
end
x = abs(x)
y = abs(y)
function tmp_2 = code(x, y)
	t_0 = y * (y * 4.0);
	t_1 = ((x * x) - t_0) / ((x * x) + t_0);
	tmp = 0.0;
	if (x <= 3.1e-78)
		tmp = -1.0;
	elseif (x <= 4.4e-51)
		tmp = t_1;
	elseif (x <= 2.8e-24)
		tmp = -1.0;
	elseif (x <= 2.4e+14)
		tmp = t_1;
	elseif (x <= 6e+40)
		tmp = -1.0;
	elseif (x <= 6.8e+126)
		tmp = t_1;
	else
		tmp = 1.0 - (((y / x) * (y / x)) * 8.0);
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 3.1e-78], -1.0, If[LessEqual[x, 4.4e-51], t$95$1, If[LessEqual[x, 2.8e-24], -1.0, If[LessEqual[x, 2.4e+14], t$95$1, If[LessEqual[x, 6e+40], -1.0, If[LessEqual[x, 6.8e+126], t$95$1, N[(1.0 - N[(N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] * 8.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\
\mathbf{if}\;x \leq 3.1 \cdot 10^{-78}:\\
\;\;\;\;-1\\

\mathbf{elif}\;x \leq 4.4 \cdot 10^{-51}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 2.8 \cdot 10^{-24}:\\
\;\;\;\;-1\\

\mathbf{elif}\;x \leq 2.4 \cdot 10^{+14}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 6 \cdot 10^{+40}:\\
\;\;\;\;-1\\

\mathbf{elif}\;x \leq 6.8 \cdot 10^{+126}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < 3.10000000000000018e-78 or 4.4e-51 < x < 2.8000000000000002e-24 or 2.4e14 < x < 6.0000000000000004e40

    1. Initial program 47.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 65.4%

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

    if 3.10000000000000018e-78 < x < 4.4e-51 or 2.8000000000000002e-24 < x < 2.4e14 or 6.0000000000000004e40 < x < 6.79999999999999979e126

    1. Initial program 89.4%

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

    if 6.79999999999999979e126 < x

    1. Initial program 13.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. add-sqr-sqrt13.5%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares13.5%

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

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

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt13.5%

        \[\leadsto \frac{\left(x + \color{blue}{y} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      8. metadata-eval13.5%

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

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

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt13.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval13.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    3. Applied egg-rr13.5%

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Taylor expanded in x around -inf 75.7%

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

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

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

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

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

        \[\leadsto 1 + \color{blue}{-1 \cdot \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{{x}^{2}}} \]
      6. mul-1-neg75.7%

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

        \[\leadsto \color{blue}{1 - \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{{x}^{2}}} \]
      8. unpow275.7%

        \[\leadsto 1 - \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{\color{blue}{x \cdot x}} \]
      9. div-sub75.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.1 \cdot 10^{-78}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{-51}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-24}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{+14}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{elif}\;x \leq 6 \cdot 10^{+40}:\\ \;\;\;\;-1\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{+126}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{else}:\\ \;\;\;\;1 - \left(\frac{y}{x} \cdot \frac{y}{x}\right) \cdot 8\\ \end{array} \]

Alternative 7: 74.2% accurate, 1.5× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.9199999999999999e56

    1. Initial program 51.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 0 63.0%

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

    if 1.9199999999999999e56 < x

    1. Initial program 38.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. add-sqr-sqrt38.6%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares38.6%

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

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

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt36.8%

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

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

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod21.0%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt38.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval38.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    3. Applied egg-rr38.6%

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Taylor expanded in x around -inf 77.1%

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

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

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

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

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

        \[\leadsto 1 + \color{blue}{-1 \cdot \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{{x}^{2}}} \]
      6. mul-1-neg77.1%

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

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

        \[\leadsto 1 - \frac{4 \cdot {y}^{2} - -4 \cdot {y}^{2}}{\color{blue}{x \cdot x}} \]
      9. div-sub77.1%

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

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

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

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

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

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

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

Alternative 8: 73.8% accurate, 6.2× speedup?

\[\begin{array}{l} x = |x|\\ y = |y|\\ \\ \begin{array}{l} \mathbf{if}\;x \leq 10^{+55}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y) :precision binary64 (if (<= x 1e+55) -1.0 1.0))
x = abs(x);
y = abs(y);
double code(double x, double y) {
	double tmp;
	if (x <= 1e+55) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= 1d+55) then
        tmp = -1.0d0
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
	double tmp;
	if (x <= 1e+55) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
x = abs(x)
y = abs(y)
def code(x, y):
	tmp = 0
	if x <= 1e+55:
		tmp = -1.0
	else:
		tmp = 1.0
	return tmp
x = abs(x)
y = abs(y)
function code(x, y)
	tmp = 0.0
	if (x <= 1e+55)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	return tmp
end
x = abs(x)
y = abs(y)
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= 1e+55)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := If[LessEqual[x, 1e+55], -1.0, 1.0]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+55}:\\
\;\;\;\;-1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 1.00000000000000001e55

    1. Initial program 51.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 0 63.0%

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

    if 1.00000000000000001e55 < x

    1. Initial program 38.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 inf 87.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 10^{+55}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 9: 51.2% accurate, 19.0× speedup?

\[\begin{array}{l} x = |x|\\ y = |y|\\ \\ -1 \end{array} \]
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y) :precision binary64 -1.0)
x = abs(x);
y = abs(y);
double code(double x, double y) {
	return -1.0;
}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = -1.0d0
end function
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
	return -1.0;
}
x = abs(x)
y = abs(y)
def code(x, y):
	return -1.0
x = abs(x)
y = abs(y)
function code(x, y)
	return -1.0
end
x = abs(x)
y = abs(y)
function tmp = code(x, y)
	tmp = -1.0;
end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := -1.0
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
-1
\end{array}
Derivation
  1. Initial program 48.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 0 52.0%

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

    \[\leadsto -1 \]

Developer target: 51.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 2023202 
(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))))