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

Percentage Accurate: 50.6% → 80.8%
Time: 8.5s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 50.6% accurate, 1.0× speedup?

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

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

Alternative 1: 80.8% accurate, 0.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.4000000000000001e-97

    1. Initial program 53.5%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)} \]
    5. Step-by-step derivation
      1. add-log-exp57.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log \left(e^{\frac{y}{x} \cdot \frac{y}{x}}\right)}, -8, 1\right) \]
      2. add-sqr-sqrt57.9%

        \[\leadsto \mathsf{fma}\left(\log \color{blue}{\left(\sqrt{e^{\frac{y}{x} \cdot \frac{y}{x}}} \cdot \sqrt{e^{\frac{y}{x} \cdot \frac{y}{x}}}\right)}, -8, 1\right) \]
      3. log-prod57.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log \left(\sqrt{e^{\frac{y}{x} \cdot \frac{y}{x}}}\right) + \log \left(\sqrt{e^{\frac{y}{x} \cdot \frac{y}{x}}}\right)}, -8, 1\right) \]
      4. pow257.9%

        \[\leadsto \mathsf{fma}\left(\log \left(\sqrt{e^{\color{blue}{{\left(\frac{y}{x}\right)}^{2}}}}\right) + \log \left(\sqrt{e^{\frac{y}{x} \cdot \frac{y}{x}}}\right), -8, 1\right) \]
      5. pow257.9%

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\log \left(\sqrt{e^{{\left(\frac{y}{x}\right)}^{2}}}\right) + \log \left(\sqrt{e^{{\left(\frac{y}{x}\right)}^{2}}}\right)}, -8, 1\right) \]
    7. Step-by-step derivation
      1. count-257.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \log \left(\sqrt{e^{{\left(\frac{y}{x}\right)}^{2}}}\right)}, -8, 1\right) \]
    8. Simplified57.9%

      \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \log \left(\sqrt{e^{{\left(\frac{y}{x}\right)}^{2}}}\right)}, -8, 1\right) \]
    9. Taylor expanded in y around 0 54.5%

      \[\leadsto \mathsf{fma}\left(2 \cdot \log \color{blue}{\left(1 + 0.5 \cdot \frac{{y}^{2}}{{x}^{2}}\right)}, -8, 1\right) \]
    10. Step-by-step derivation
      1. unpow254.5%

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

        \[\leadsto \mathsf{fma}\left(2 \cdot \log \left(1 + 0.5 \cdot \frac{y \cdot y}{\color{blue}{x \cdot x}}\right), -8, 1\right) \]
      3. times-frac60.0%

        \[\leadsto \mathsf{fma}\left(2 \cdot \log \left(1 + 0.5 \cdot \color{blue}{\left(\frac{y}{x} \cdot \frac{y}{x}\right)}\right), -8, 1\right) \]
      4. unpow260.0%

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

      \[\leadsto \mathsf{fma}\left(2 \cdot \log \color{blue}{\left(1 + 0.5 \cdot {\left(\frac{y}{x}\right)}^{2}\right)}, -8, 1\right) \]
    12. Step-by-step derivation
      1. *-un-lft-identity60.0%

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

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

        \[\leadsto \mathsf{fma}\left(2 \cdot \left(\color{blue}{0} + \log \left(1 + 0.5 \cdot {\left(\frac{y}{x}\right)}^{2}\right)\right), -8, 1\right) \]
      4. log1p-def60.1%

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

        \[\leadsto \mathsf{fma}\left(2 \cdot \left(0 + \mathsf{log1p}\left(0.5 \cdot \color{blue}{\left(\frac{y}{x} \cdot \frac{y}{x}\right)}\right)\right), -8, 1\right) \]
      6. clear-num60.1%

        \[\leadsto \mathsf{fma}\left(2 \cdot \left(0 + \mathsf{log1p}\left(0.5 \cdot \left(\color{blue}{\frac{1}{\frac{x}{y}}} \cdot \frac{y}{x}\right)\right)\right), -8, 1\right) \]
      7. associate-/r/60.1%

        \[\leadsto \mathsf{fma}\left(2 \cdot \left(0 + \mathsf{log1p}\left(0.5 \cdot \color{blue}{\frac{1}{\frac{\frac{x}{y}}{\frac{y}{x}}}}\right)\right), -8, 1\right) \]
      8. un-div-inv60.1%

        \[\leadsto \mathsf{fma}\left(2 \cdot \left(0 + \mathsf{log1p}\left(\color{blue}{\frac{0.5}{\frac{\frac{x}{y}}{\frac{y}{x}}}}\right)\right), -8, 1\right) \]
      9. div-inv60.1%

        \[\leadsto \mathsf{fma}\left(2 \cdot \left(0 + \mathsf{log1p}\left(\frac{0.5}{\color{blue}{\frac{x}{y} \cdot \frac{1}{\frac{y}{x}}}}\right)\right), -8, 1\right) \]
      10. clear-num60.1%

        \[\leadsto \mathsf{fma}\left(2 \cdot \left(0 + \mathsf{log1p}\left(\frac{0.5}{\frac{x}{y} \cdot \color{blue}{\frac{x}{y}}}\right)\right), -8, 1\right) \]
      11. pow260.1%

        \[\leadsto \mathsf{fma}\left(2 \cdot \left(0 + \mathsf{log1p}\left(\frac{0.5}{\color{blue}{{\left(\frac{x}{y}\right)}^{2}}}\right)\right), -8, 1\right) \]
    13. Applied egg-rr60.1%

      \[\leadsto \mathsf{fma}\left(2 \cdot \color{blue}{\left(0 + \mathsf{log1p}\left(\frac{0.5}{{\left(\frac{x}{y}\right)}^{2}}\right)\right)}, -8, 1\right) \]
    14. Step-by-step derivation
      1. +-lft-identity60.1%

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

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

    if 1.4000000000000001e-97 < y < 1.74999999999999998e112

    1. Initial program 76.3%

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

    if 1.74999999999999998e112 < y

    1. Initial program 15.2%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Taylor expanded in x around 0 65.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.4 \cdot 10^{-97}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \mathsf{log1p}\left(\frac{0.5}{{\left(\frac{x}{y}\right)}^{2}}\right), -8, 1\right)\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{+112}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \end{array} \]

Alternative 2: 80.8% accurate, 0.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.00000000000000004e-97

    1. Initial program 53.5%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)} \]
    5. Step-by-step derivation
      1. add-log-exp57.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log \left(e^{\frac{y}{x} \cdot \frac{y}{x}}\right)}, -8, 1\right) \]
      2. add-sqr-sqrt57.9%

        \[\leadsto \mathsf{fma}\left(\log \color{blue}{\left(\sqrt{e^{\frac{y}{x} \cdot \frac{y}{x}}} \cdot \sqrt{e^{\frac{y}{x} \cdot \frac{y}{x}}}\right)}, -8, 1\right) \]
      3. log-prod57.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log \left(\sqrt{e^{\frac{y}{x} \cdot \frac{y}{x}}}\right) + \log \left(\sqrt{e^{\frac{y}{x} \cdot \frac{y}{x}}}\right)}, -8, 1\right) \]
      4. pow257.9%

        \[\leadsto \mathsf{fma}\left(\log \left(\sqrt{e^{\color{blue}{{\left(\frac{y}{x}\right)}^{2}}}}\right) + \log \left(\sqrt{e^{\frac{y}{x} \cdot \frac{y}{x}}}\right), -8, 1\right) \]
      5. pow257.9%

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\log \left(\sqrt{e^{{\left(\frac{y}{x}\right)}^{2}}}\right) + \log \left(\sqrt{e^{{\left(\frac{y}{x}\right)}^{2}}}\right)}, -8, 1\right) \]
    7. Step-by-step derivation
      1. count-257.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \log \left(\sqrt{e^{{\left(\frac{y}{x}\right)}^{2}}}\right)}, -8, 1\right) \]
    8. Simplified57.9%

      \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \log \left(\sqrt{e^{{\left(\frac{y}{x}\right)}^{2}}}\right)}, -8, 1\right) \]
    9. Taylor expanded in y around 0 54.5%

      \[\leadsto \mathsf{fma}\left(2 \cdot \log \color{blue}{\left(1 + 0.5 \cdot \frac{{y}^{2}}{{x}^{2}}\right)}, -8, 1\right) \]
    10. Step-by-step derivation
      1. unpow254.5%

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

        \[\leadsto \mathsf{fma}\left(2 \cdot \log \left(1 + 0.5 \cdot \frac{y \cdot y}{\color{blue}{x \cdot x}}\right), -8, 1\right) \]
      3. times-frac60.0%

        \[\leadsto \mathsf{fma}\left(2 \cdot \log \left(1 + 0.5 \cdot \color{blue}{\left(\frac{y}{x} \cdot \frac{y}{x}\right)}\right), -8, 1\right) \]
      4. unpow260.0%

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

      \[\leadsto \mathsf{fma}\left(2 \cdot \log \color{blue}{\left(1 + 0.5 \cdot {\left(\frac{y}{x}\right)}^{2}\right)}, -8, 1\right) \]
    12. Step-by-step derivation
      1. *-commutative60.0%

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

        \[\leadsto \mathsf{fma}\left(2 \cdot \log \left(1 + \color{blue}{\left(\frac{y}{x} \cdot \frac{y}{x}\right)} \cdot 0.5\right), -8, 1\right) \]
      3. clear-num60.0%

        \[\leadsto \mathsf{fma}\left(2 \cdot \log \left(1 + \left(\frac{y}{x} \cdot \color{blue}{\frac{1}{\frac{x}{y}}}\right) \cdot 0.5\right), -8, 1\right) \]
      4. div-inv60.0%

        \[\leadsto \mathsf{fma}\left(2 \cdot \log \left(1 + \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \cdot 0.5\right), -8, 1\right) \]
      5. associate-*l/60.0%

        \[\leadsto \mathsf{fma}\left(2 \cdot \log \left(1 + \color{blue}{\frac{\frac{y}{x} \cdot 0.5}{\frac{x}{y}}}\right), -8, 1\right) \]
    13. Applied egg-rr60.0%

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

    if 1.00000000000000004e-97 < y < 1.59999999999999993e112

    1. Initial program 76.3%

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

    if 1.59999999999999993e112 < y

    1. Initial program 15.2%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Taylor expanded in x around 0 65.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 10^{-97}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \log \left(1 + \frac{0.5 \cdot \frac{y}{x}}{\frac{x}{y}}\right), -8, 1\right)\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+112}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \end{array} \]

Alternative 3: 80.4% accurate, 0.2× speedup?

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

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

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


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

    1. Initial program 59.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000002e-194 < (*.f64 (*.f64 y 4) y) < 4.9999999999999998e216

    1. Initial program 79.2%

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

    if 4.9999999999999998e216 < (*.f64 (*.f64 y 4) y)

    1. Initial program 15.1%

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

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

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

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

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

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

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

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

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

Alternative 4: 80.3% accurate, 0.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.59999999999999998e-94

    1. Initial program 53.5%

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

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

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

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

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

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

        \[\leadsto 1 + -4 \cdot \frac{y \cdot y}{\color{blue}{x \cdot x}} \]
      3. times-frac58.2%

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

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

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

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

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

        \[\leadsto 1 + -4 \cdot \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \]
    9. Applied egg-rr58.2%

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

    if 1.59999999999999998e-94 < y < 5.2000000000000001e112

    1. Initial program 76.3%

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

    if 5.2000000000000001e112 < y

    1. Initial program 15.2%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Taylor expanded in x around 0 65.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification63.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.6 \cdot 10^{-94}:\\ \;\;\;\;1 + -4 \cdot \frac{\frac{y}{x}}{\frac{x}{y}}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{+112}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\ \end{array} \]

Alternative 5: 80.0% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 9.5000000000000001e-98

    1. Initial program 53.5%

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

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

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

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

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

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

        \[\leadsto 1 + -4 \cdot \frac{y \cdot y}{\color{blue}{x \cdot x}} \]
      3. times-frac58.2%

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

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

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

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

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

        \[\leadsto 1 + -4 \cdot \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \]
    9. Applied egg-rr58.2%

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

    if 9.5000000000000001e-98 < y < 1.15000000000000001e111

    1. Initial program 76.3%

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

    if 1.15000000000000001e111 < y

    1. Initial program 15.2%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Taylor expanded in x around 0 72.1%

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

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

Alternative 6: 74.1% accurate, 1.1× speedup?

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

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


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

    1. Initial program 64.3%

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

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

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

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

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

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

        \[\leadsto 1 + -4 \cdot \frac{y \cdot y}{\color{blue}{x \cdot x}} \]
      3. times-frac80.9%

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

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

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

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

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

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

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

    if 9.99999999999999908e-22 < (*.f64 (*.f64 y 4) y)

    1. Initial program 35.4%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Taylor expanded in x around 0 79.5%

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

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

Alternative 7: 73.6% accurate, 6.2× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.99999999999999988e-11

    1. Initial program 56.3%

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

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

    if 1.99999999999999988e-11 < y

    1. Initial program 31.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 68.6%

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

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

Alternative 8: 50.2% accurate, 19.0× speedup?

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

    \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
  2. Taylor expanded in x around 0 49.8%

    \[\leadsto \color{blue}{-1} \]
  3. Final simplification49.8%

    \[\leadsto -1 \]

Developer target: 51.2% 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 2023229 
(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))))