Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A

Percentage Accurate: 68.9% → 91.2%
Time: 13.2s
Alternatives: 16
Speedup: 1.4×

Specification

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

\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\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 16 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: 68.9% accurate, 1.0× speedup?

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

\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}

Alternative 1: 91.2% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := x + \left(y + 1\right)\\ \mathbf{if}\;y \leq 10^{-159}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+71}:\\ \;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\mathsf{fma}\left(x, 2, y\right)}}{\frac{t\_0}{x}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (+ y 1.0))))
   (if (<= y 1e-159)
     (/ (/ y (+ x 1.0)) x)
     (if (<= y 2.4e+71)
       (* x (/ y (* (* (+ y x) (+ y x)) t_0)))
       (/ (/ 1.0 (fma x 2.0 y)) (/ t_0 x))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = x + (y + 1.0);
	double tmp;
	if (y <= 1e-159) {
		tmp = (y / (x + 1.0)) / x;
	} else if (y <= 2.4e+71) {
		tmp = x * (y / (((y + x) * (y + x)) * t_0));
	} else {
		tmp = (1.0 / fma(x, 2.0, y)) / (t_0 / x);
	}
	return tmp;
}
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(x + Float64(y + 1.0))
	tmp = 0.0
	if (y <= 1e-159)
		tmp = Float64(Float64(y / Float64(x + 1.0)) / x);
	elseif (y <= 2.4e+71)
		tmp = Float64(x * Float64(y / Float64(Float64(Float64(y + x) * Float64(y + x)) * t_0)));
	else
		tmp = Float64(Float64(1.0 / fma(x, 2.0, y)) / Float64(t_0 / x));
	end
	return tmp
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1e-159], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 2.4e+71], N[(x * N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x * 2.0 + y), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 10^{-159}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\

\mathbf{elif}\;y \leq 2.4 \cdot 10^{+71}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{fma}\left(x, 2, y\right)}}{\frac{t\_0}{x}}\\


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

    1. Initial program 72.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 72.3%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. +-commutative59.9%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(x + 1\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity59.9%

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

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{y}{x + 1}} \]
    9. Step-by-step derivation
      1. associate-*l/59.8%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x + 1}}}{x} \]
    10. Simplified59.8%

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

    if 9.99999999999999989e-160 < y < 2.39999999999999981e71

    1. Initial program 88.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*91.4%

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

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

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

    if 2.39999999999999981e71 < y

    1. Initial program 49.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*76.9%

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left({y}^{2} + \left(2 \cdot x\right) \cdot y\right)} \cdot \left(x + \left(y + 1\right)\right)} \]
      3. unpow262.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{x + \left(y + 1\right)} \cdot \frac{y}{y \cdot \mathsf{fma}\left(x, 2, y\right)}} \]
      2. associate-/r*90.1%

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

        \[\leadsto \frac{x}{x + \left(y + 1\right)} \cdot \frac{\color{blue}{1}}{\mathsf{fma}\left(x, 2, y\right)} \]
    11. Simplified90.1%

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(x, 2, y\right)}}{\frac{x + \left(y + 1\right)}{x}}} \]
    13. Applied egg-rr90.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 10^{-159}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+71}:\\ \;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\mathsf{fma}\left(x, 2, y\right)}}{\frac{x + \left(y + 1\right)}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 91.2% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := x + \left(y + 1\right)\\ \mathbf{if}\;y \leq 1.5 \cdot 10^{-158}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+71}:\\ \;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{\mathsf{fma}\left(x, 2, y\right)}}{t\_0}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (+ y 1.0))))
   (if (<= y 1.5e-158)
     (/ (/ y (+ x 1.0)) x)
     (if (<= y 2.4e+71)
       (* x (/ y (* (* (+ y x) (+ y x)) t_0)))
       (/ (/ x (fma x 2.0 y)) t_0)))))
assert(x < y);
double code(double x, double y) {
	double t_0 = x + (y + 1.0);
	double tmp;
	if (y <= 1.5e-158) {
		tmp = (y / (x + 1.0)) / x;
	} else if (y <= 2.4e+71) {
		tmp = x * (y / (((y + x) * (y + x)) * t_0));
	} else {
		tmp = (x / fma(x, 2.0, y)) / t_0;
	}
	return tmp;
}
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(x + Float64(y + 1.0))
	tmp = 0.0
	if (y <= 1.5e-158)
		tmp = Float64(Float64(y / Float64(x + 1.0)) / x);
	elseif (y <= 2.4e+71)
		tmp = Float64(x * Float64(y / Float64(Float64(Float64(y + x) * Float64(y + x)) * t_0)));
	else
		tmp = Float64(Float64(x / fma(x, 2.0, y)) / t_0);
	end
	return tmp
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.5e-158], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 2.4e+71], N[(x * N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x * 2.0 + y), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 1.5 \cdot 10^{-158}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\

\mathbf{elif}\;y \leq 2.4 \cdot 10^{+71}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{\mathsf{fma}\left(x, 2, y\right)}}{t\_0}\\


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

    1. Initial program 72.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 72.3%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. +-commutative59.9%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(x + 1\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity59.9%

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

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{y}{x + 1}} \]
    9. Step-by-step derivation
      1. associate-*l/59.8%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x + 1}}}{x} \]
    10. Simplified59.8%

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

    if 1.5e-158 < y < 2.39999999999999981e71

    1. Initial program 88.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*91.4%

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

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

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

    if 2.39999999999999981e71 < y

    1. Initial program 49.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*76.9%

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left({y}^{2} + \left(2 \cdot x\right) \cdot y\right)} \cdot \left(x + \left(y + 1\right)\right)} \]
      3. unpow262.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{x + \left(y + 1\right)} \cdot \frac{y}{y \cdot \mathsf{fma}\left(x, 2, y\right)}} \]
      2. associate-/r*90.1%

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

        \[\leadsto \frac{x}{x + \left(y + 1\right)} \cdot \frac{\color{blue}{1}}{\mathsf{fma}\left(x, 2, y\right)} \]
    11. Simplified90.1%

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{\mathsf{fma}\left(x, 2, y\right)}}}{x + \left(y + 1\right)} \]
    13. Applied egg-rr90.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.5 \cdot 10^{-158}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+71}:\\ \;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{\mathsf{fma}\left(x, 2, y\right)}}{x + \left(y + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 79.5% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{if}\;y \leq 6.8 \cdot 10^{-112}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 880000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+147}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ y (* x (+ x 1.0)))))
   (if (<= y 6.8e-112)
     t_0
     (if (<= y 4.6e-24)
       (/ x y)
       (if (<= y 880000.0)
         t_0
         (if (<= y 6e+147) (/ x (* y (+ y 1.0))) (* (/ x y) (/ 1.0 y))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (y <= 6.8e-112) {
		tmp = t_0;
	} else if (y <= 4.6e-24) {
		tmp = x / y;
	} else if (y <= 880000.0) {
		tmp = t_0;
	} else if (y <= 6e+147) {
		tmp = x / (y * (y + 1.0));
	} else {
		tmp = (x / y) * (1.0 / y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order 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 / (x * (x + 1.0d0))
    if (y <= 6.8d-112) then
        tmp = t_0
    else if (y <= 4.6d-24) then
        tmp = x / y
    else if (y <= 880000.0d0) then
        tmp = t_0
    else if (y <= 6d+147) then
        tmp = x / (y * (y + 1.0d0))
    else
        tmp = (x / y) * (1.0d0 / y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (y <= 6.8e-112) {
		tmp = t_0;
	} else if (y <= 4.6e-24) {
		tmp = x / y;
	} else if (y <= 880000.0) {
		tmp = t_0;
	} else if (y <= 6e+147) {
		tmp = x / (y * (y + 1.0));
	} else {
		tmp = (x / y) * (1.0 / y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * (x + 1.0))
	tmp = 0
	if y <= 6.8e-112:
		tmp = t_0
	elif y <= 4.6e-24:
		tmp = x / y
	elif y <= 880000.0:
		tmp = t_0
	elif y <= 6e+147:
		tmp = x / (y * (y + 1.0))
	else:
		tmp = (x / y) * (1.0 / y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x * Float64(x + 1.0)))
	tmp = 0.0
	if (y <= 6.8e-112)
		tmp = t_0;
	elseif (y <= 4.6e-24)
		tmp = Float64(x / y);
	elseif (y <= 880000.0)
		tmp = t_0;
	elseif (y <= 6e+147)
		tmp = Float64(x / Float64(y * Float64(y + 1.0)));
	else
		tmp = Float64(Float64(x / y) * Float64(1.0 / y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x * (x + 1.0));
	tmp = 0.0;
	if (y <= 6.8e-112)
		tmp = t_0;
	elseif (y <= 4.6e-24)
		tmp = x / y;
	elseif (y <= 880000.0)
		tmp = t_0;
	elseif (y <= 6e+147)
		tmp = x / (y * (y + 1.0));
	else
		tmp = (x / y) * (1.0 / y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 6.8e-112], t$95$0, If[LessEqual[y, 4.6e-24], N[(x / y), $MachinePrecision], If[LessEqual[y, 880000.0], t$95$0, If[LessEqual[y, 6e+147], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;y \leq 6.8 \cdot 10^{-112}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 4.6 \cdot 10^{-24}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;y \leq 880000:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 6.7999999999999996e-112 or 4.6000000000000002e-24 < y < 8.8e5

    1. Initial program 73.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*85.7%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified85.7%

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

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

    if 6.7999999999999996e-112 < y < 4.6000000000000002e-24

    1. Initial program 99.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*96.7%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified96.7%

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

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

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified32.3%

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

      \[\leadsto \color{blue}{\frac{x}{y}} \]

    if 8.8e5 < y < 5.99999999999999987e147

    1. Initial program 63.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*72.3%

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

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

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

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

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

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

    if 5.99999999999999987e147 < y

    1. Initial program 49.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*81.6%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified81.6%

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

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

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified81.6%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity81.6%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y + 1} \cdot \frac{x}{y}} \]
    10. Taylor expanded in y around inf 92.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 6.8 \cdot 10^{-112}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 880000:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+147}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 91.2% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := x + \left(y + 1\right)\\ \mathbf{if}\;y \leq 2 \cdot 10^{-159}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{+76}:\\ \;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t\_0} \cdot \frac{1 + -2 \cdot \frac{x}{y}}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (+ y 1.0))))
   (if (<= y 2e-159)
     (/ (/ y (+ x 1.0)) x)
     (if (<= y 6.8e+76)
       (* x (/ y (* (* (+ y x) (+ y x)) t_0)))
       (* (/ x t_0) (/ (+ 1.0 (* -2.0 (/ x y))) y))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = x + (y + 1.0);
	double tmp;
	if (y <= 2e-159) {
		tmp = (y / (x + 1.0)) / x;
	} else if (y <= 6.8e+76) {
		tmp = x * (y / (((y + x) * (y + x)) * t_0));
	} else {
		tmp = (x / t_0) * ((1.0 + (-2.0 * (x / y))) / y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order 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 = x + (y + 1.0d0)
    if (y <= 2d-159) then
        tmp = (y / (x + 1.0d0)) / x
    else if (y <= 6.8d+76) then
        tmp = x * (y / (((y + x) * (y + x)) * t_0))
    else
        tmp = (x / t_0) * ((1.0d0 + ((-2.0d0) * (x / y))) / y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = x + (y + 1.0);
	double tmp;
	if (y <= 2e-159) {
		tmp = (y / (x + 1.0)) / x;
	} else if (y <= 6.8e+76) {
		tmp = x * (y / (((y + x) * (y + x)) * t_0));
	} else {
		tmp = (x / t_0) * ((1.0 + (-2.0 * (x / y))) / y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = x + (y + 1.0)
	tmp = 0
	if y <= 2e-159:
		tmp = (y / (x + 1.0)) / x
	elif y <= 6.8e+76:
		tmp = x * (y / (((y + x) * (y + x)) * t_0))
	else:
		tmp = (x / t_0) * ((1.0 + (-2.0 * (x / y))) / y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(x + Float64(y + 1.0))
	tmp = 0.0
	if (y <= 2e-159)
		tmp = Float64(Float64(y / Float64(x + 1.0)) / x);
	elseif (y <= 6.8e+76)
		tmp = Float64(x * Float64(y / Float64(Float64(Float64(y + x) * Float64(y + x)) * t_0)));
	else
		tmp = Float64(Float64(x / t_0) * Float64(Float64(1.0 + Float64(-2.0 * Float64(x / y))) / y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = x + (y + 1.0);
	tmp = 0.0;
	if (y <= 2e-159)
		tmp = (y / (x + 1.0)) / x;
	elseif (y <= 6.8e+76)
		tmp = x * (y / (((y + x) * (y + x)) * t_0));
	else
		tmp = (x / t_0) * ((1.0 + (-2.0 * (x / y))) / y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2e-159], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 6.8e+76], N[(x * N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / t$95$0), $MachinePrecision] * N[(N[(1.0 + N[(-2.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 2 \cdot 10^{-159}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\

\mathbf{elif}\;y \leq 6.8 \cdot 10^{+76}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{t\_0} \cdot \frac{1 + -2 \cdot \frac{x}{y}}{y}\\


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

    1. Initial program 72.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 72.3%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. +-commutative59.9%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(x + 1\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity59.9%

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

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{y}{x + 1}} \]
    9. Step-by-step derivation
      1. associate-*l/59.8%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x + 1}}}{x} \]
    10. Simplified59.8%

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

    if 1.99999999999999998e-159 < y < 6.7999999999999994e76

    1. Initial program 88.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*91.4%

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

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

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

    if 6.7999999999999994e76 < y

    1. Initial program 49.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*76.9%

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left({y}^{2} + \left(2 \cdot x\right) \cdot y\right)} \cdot \left(x + \left(y + 1\right)\right)} \]
      3. unpow262.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{x + \left(y + 1\right)} \cdot \frac{y}{y \cdot \mathsf{fma}\left(x, 2, y\right)}} \]
      2. associate-/r*90.1%

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

        \[\leadsto \frac{x}{x + \left(y + 1\right)} \cdot \frac{\color{blue}{1}}{\mathsf{fma}\left(x, 2, y\right)} \]
    11. Simplified90.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2 \cdot 10^{-159}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{+76}:\\ \;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + \left(y + 1\right)} \cdot \frac{1 + -2 \cdot \frac{x}{y}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 91.4% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := x + \left(y + 1\right)\\ \mathbf{if}\;y \leq 1.8 \cdot 10^{-159}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{+99}:\\ \;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y}}{\frac{t\_0}{x}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (+ y 1.0))))
   (if (<= y 1.8e-159)
     (/ (/ y (+ x 1.0)) x)
     (if (<= y 2.5e+99)
       (* x (/ y (* (* (+ y x) (+ y x)) t_0)))
       (/ (/ 1.0 y) (/ t_0 x))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = x + (y + 1.0);
	double tmp;
	if (y <= 1.8e-159) {
		tmp = (y / (x + 1.0)) / x;
	} else if (y <= 2.5e+99) {
		tmp = x * (y / (((y + x) * (y + x)) * t_0));
	} else {
		tmp = (1.0 / y) / (t_0 / x);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order 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 = x + (y + 1.0d0)
    if (y <= 1.8d-159) then
        tmp = (y / (x + 1.0d0)) / x
    else if (y <= 2.5d+99) then
        tmp = x * (y / (((y + x) * (y + x)) * t_0))
    else
        tmp = (1.0d0 / y) / (t_0 / x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = x + (y + 1.0);
	double tmp;
	if (y <= 1.8e-159) {
		tmp = (y / (x + 1.0)) / x;
	} else if (y <= 2.5e+99) {
		tmp = x * (y / (((y + x) * (y + x)) * t_0));
	} else {
		tmp = (1.0 / y) / (t_0 / x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = x + (y + 1.0)
	tmp = 0
	if y <= 1.8e-159:
		tmp = (y / (x + 1.0)) / x
	elif y <= 2.5e+99:
		tmp = x * (y / (((y + x) * (y + x)) * t_0))
	else:
		tmp = (1.0 / y) / (t_0 / x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(x + Float64(y + 1.0))
	tmp = 0.0
	if (y <= 1.8e-159)
		tmp = Float64(Float64(y / Float64(x + 1.0)) / x);
	elseif (y <= 2.5e+99)
		tmp = Float64(x * Float64(y / Float64(Float64(Float64(y + x) * Float64(y + x)) * t_0)));
	else
		tmp = Float64(Float64(1.0 / y) / Float64(t_0 / x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = x + (y + 1.0);
	tmp = 0.0;
	if (y <= 1.8e-159)
		tmp = (y / (x + 1.0)) / x;
	elseif (y <= 2.5e+99)
		tmp = x * (y / (((y + x) * (y + x)) * t_0));
	else
		tmp = (1.0 / y) / (t_0 / x);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.8e-159], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 2.5e+99], N[(x * N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] / N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 1.8 \cdot 10^{-159}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\

\mathbf{elif}\;y \leq 2.5 \cdot 10^{+99}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{\frac{t\_0}{x}}\\


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

    1. Initial program 72.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 72.3%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. +-commutative59.9%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(x + 1\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity59.9%

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

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{y}{x + 1}} \]
    9. Step-by-step derivation
      1. associate-*l/59.8%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x + 1}}}{x} \]
    10. Simplified59.8%

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

    if 1.80000000000000011e-159 < y < 2.50000000000000004e99

    1. Initial program 86.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*89.5%

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

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

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

    if 2.50000000000000004e99 < y

    1. Initial program 49.9%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*78.0%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified78.0%

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\left(y \cdot \left(y + \color{blue}{x \cdot 2}\right)\right) \cdot \left(x + \left(y + 1\right)\right)} \]
    7. Simplified78.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{x + \left(y + 1\right)} \cdot \frac{y}{y \cdot \mathsf{fma}\left(x, 2, y\right)}} \]
      2. associate-/r*91.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(x, 2, y\right)}}{\frac{x + \left(y + 1\right)}{x}}} \]
    14. Taylor expanded in x around 0 90.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.8 \cdot 10^{-159}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{+99}:\\ \;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y}}{\frac{x + \left(y + 1\right)}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 86.5% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := x + \left(y + 1\right)\\ \mathbf{if}\;y \leq 2.2 \cdot 10^{-157}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{+99}:\\ \;\;\;\;x \cdot \frac{y}{t\_0 \cdot \left(y \cdot \left(y + x \cdot 2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y}}{\frac{t\_0}{x}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (+ y 1.0))))
   (if (<= y 2.2e-157)
     (/ (/ y (+ x 1.0)) x)
     (if (<= y 2.5e+99)
       (* x (/ y (* t_0 (* y (+ y (* x 2.0))))))
       (/ (/ 1.0 y) (/ t_0 x))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = x + (y + 1.0);
	double tmp;
	if (y <= 2.2e-157) {
		tmp = (y / (x + 1.0)) / x;
	} else if (y <= 2.5e+99) {
		tmp = x * (y / (t_0 * (y * (y + (x * 2.0)))));
	} else {
		tmp = (1.0 / y) / (t_0 / x);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order 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 = x + (y + 1.0d0)
    if (y <= 2.2d-157) then
        tmp = (y / (x + 1.0d0)) / x
    else if (y <= 2.5d+99) then
        tmp = x * (y / (t_0 * (y * (y + (x * 2.0d0)))))
    else
        tmp = (1.0d0 / y) / (t_0 / x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = x + (y + 1.0);
	double tmp;
	if (y <= 2.2e-157) {
		tmp = (y / (x + 1.0)) / x;
	} else if (y <= 2.5e+99) {
		tmp = x * (y / (t_0 * (y * (y + (x * 2.0)))));
	} else {
		tmp = (1.0 / y) / (t_0 / x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = x + (y + 1.0)
	tmp = 0
	if y <= 2.2e-157:
		tmp = (y / (x + 1.0)) / x
	elif y <= 2.5e+99:
		tmp = x * (y / (t_0 * (y * (y + (x * 2.0)))))
	else:
		tmp = (1.0 / y) / (t_0 / x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(x + Float64(y + 1.0))
	tmp = 0.0
	if (y <= 2.2e-157)
		tmp = Float64(Float64(y / Float64(x + 1.0)) / x);
	elseif (y <= 2.5e+99)
		tmp = Float64(x * Float64(y / Float64(t_0 * Float64(y * Float64(y + Float64(x * 2.0))))));
	else
		tmp = Float64(Float64(1.0 / y) / Float64(t_0 / x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = x + (y + 1.0);
	tmp = 0.0;
	if (y <= 2.2e-157)
		tmp = (y / (x + 1.0)) / x;
	elseif (y <= 2.5e+99)
		tmp = x * (y / (t_0 * (y * (y + (x * 2.0)))));
	else
		tmp = (1.0 / y) / (t_0 / x);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.2e-157], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 2.5e+99], N[(x * N[(y / N[(t$95$0 * N[(y * N[(y + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] / N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 2.2 \cdot 10^{-157}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\

\mathbf{elif}\;y \leq 2.5 \cdot 10^{+99}:\\
\;\;\;\;x \cdot \frac{y}{t\_0 \cdot \left(y \cdot \left(y + x \cdot 2\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{\frac{t\_0}{x}}\\


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

    1. Initial program 72.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 72.3%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. +-commutative59.9%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(x + 1\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity59.9%

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

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{y}{x + 1}} \]
    9. Step-by-step derivation
      1. associate-*l/59.8%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x + 1}}}{x} \]
    10. Simplified59.8%

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

    if 2.2000000000000001e-157 < y < 2.50000000000000004e99

    1. Initial program 86.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*89.5%

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

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

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

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

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

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

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

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

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

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

    if 2.50000000000000004e99 < y

    1. Initial program 49.9%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*78.0%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified78.0%

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\left(y \cdot \left(y + \color{blue}{x \cdot 2}\right)\right) \cdot \left(x + \left(y + 1\right)\right)} \]
    7. Simplified78.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{x + \left(y + 1\right)} \cdot \frac{y}{y \cdot \mathsf{fma}\left(x, 2, y\right)}} \]
      2. associate-/r*91.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(x, 2, y\right)}}{\frac{x + \left(y + 1\right)}{x}}} \]
    14. Taylor expanded in x around 0 90.1%

      \[\leadsto \frac{\color{blue}{\frac{1}{y}}}{\frac{x + \left(y + 1\right)}{x}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification68.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.2 \cdot 10^{-157}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{+99}:\\ \;\;\;\;x \cdot \frac{y}{\left(x + \left(y + 1\right)\right) \cdot \left(y \cdot \left(y + x \cdot 2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y}}{\frac{x + \left(y + 1\right)}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 81.1% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := x + \left(y + 1\right)\\ \mathbf{if}\;y \leq 6.8 \cdot 10^{-112}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{-24}:\\ \;\;\;\;\frac{\frac{x}{y}}{t\_0}\\ \mathbf{elif}\;y \leq 3800000:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y}}{\frac{t\_0}{x}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (+ y 1.0))))
   (if (<= y 6.8e-112)
     (/ (/ y (+ x 1.0)) x)
     (if (<= y 4.5e-24)
       (/ (/ x y) t_0)
       (if (<= y 3800000.0) (/ (/ y x) (+ x 1.0)) (/ (/ 1.0 y) (/ t_0 x)))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = x + (y + 1.0);
	double tmp;
	if (y <= 6.8e-112) {
		tmp = (y / (x + 1.0)) / x;
	} else if (y <= 4.5e-24) {
		tmp = (x / y) / t_0;
	} else if (y <= 3800000.0) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = (1.0 / y) / (t_0 / x);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order 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 = x + (y + 1.0d0)
    if (y <= 6.8d-112) then
        tmp = (y / (x + 1.0d0)) / x
    else if (y <= 4.5d-24) then
        tmp = (x / y) / t_0
    else if (y <= 3800000.0d0) then
        tmp = (y / x) / (x + 1.0d0)
    else
        tmp = (1.0d0 / y) / (t_0 / x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = x + (y + 1.0);
	double tmp;
	if (y <= 6.8e-112) {
		tmp = (y / (x + 1.0)) / x;
	} else if (y <= 4.5e-24) {
		tmp = (x / y) / t_0;
	} else if (y <= 3800000.0) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = (1.0 / y) / (t_0 / x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = x + (y + 1.0)
	tmp = 0
	if y <= 6.8e-112:
		tmp = (y / (x + 1.0)) / x
	elif y <= 4.5e-24:
		tmp = (x / y) / t_0
	elif y <= 3800000.0:
		tmp = (y / x) / (x + 1.0)
	else:
		tmp = (1.0 / y) / (t_0 / x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(x + Float64(y + 1.0))
	tmp = 0.0
	if (y <= 6.8e-112)
		tmp = Float64(Float64(y / Float64(x + 1.0)) / x);
	elseif (y <= 4.5e-24)
		tmp = Float64(Float64(x / y) / t_0);
	elseif (y <= 3800000.0)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	else
		tmp = Float64(Float64(1.0 / y) / Float64(t_0 / x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = x + (y + 1.0);
	tmp = 0.0;
	if (y <= 6.8e-112)
		tmp = (y / (x + 1.0)) / x;
	elseif (y <= 4.5e-24)
		tmp = (x / y) / t_0;
	elseif (y <= 3800000.0)
		tmp = (y / x) / (x + 1.0);
	else
		tmp = (1.0 / y) / (t_0 / x);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 6.8e-112], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 4.5e-24], N[(N[(x / y), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y, 3800000.0], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] / N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 6.8 \cdot 10^{-112}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\

\mathbf{elif}\;y \leq 4.5 \cdot 10^{-24}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_0}\\

\mathbf{elif}\;y \leq 3800000:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{\frac{t\_0}{x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 6.7999999999999996e-112

    1. Initial program 72.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 72.4%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(x + 1\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity60.2%

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

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{y}{x + 1}} \]
    9. Step-by-step derivation
      1. associate-*l/60.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x + 1}}{x}} \]
      2. *-lft-identity60.1%

        \[\leadsto \frac{\color{blue}{\frac{y}{x + 1}}}{x} \]
    10. Simplified60.1%

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

    if 6.7999999999999996e-112 < y < 4.4999999999999997e-24

    1. Initial program 99.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*96.7%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified96.7%

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

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

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

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left({y}^{2} + \left(2 \cdot x\right) \cdot y\right)} \cdot \left(x + \left(y + 1\right)\right)} \]
      3. unpow269.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{\left(x + \left(y + 1\right)\right) \cdot \left(y \cdot \mathsf{fma}\left(x, 2, y\right)\right)}} \]
    10. Step-by-step derivation
      1. times-frac33.9%

        \[\leadsto \color{blue}{\frac{x}{x + \left(y + 1\right)} \cdot \frac{y}{y \cdot \mathsf{fma}\left(x, 2, y\right)}} \]
      2. associate-/r*34.1%

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

        \[\leadsto \frac{x}{x + \left(y + 1\right)} \cdot \frac{\color{blue}{1}}{\mathsf{fma}\left(x, 2, y\right)} \]
    11. Simplified34.1%

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{\mathsf{fma}\left(x, 2, y\right)}}}{x + \left(y + 1\right)} \]
    13. Applied egg-rr34.2%

      \[\leadsto \color{blue}{\frac{\frac{x}{\mathsf{fma}\left(x, 2, y\right)}}{x + \left(y + 1\right)}} \]
    14. Taylor expanded in x around 0 32.9%

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

    if 4.4999999999999997e-24 < y < 3.8e6

    1. Initial program 97.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*97.4%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*72.2%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative72.2%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified72.2%

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

    if 3.8e6 < y

    1. Initial program 55.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*77.7%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified77.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\left(y \cdot \left(y + x \cdot 2\right)\right) \cdot \color{blue}{\left(\left(x + y\right) + 1\right)}} \]
      3. *-commutative52.6%

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

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

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

        \[\leadsto \frac{x \cdot y}{\left(x + \left(y + 1\right)\right) \cdot \left(y \cdot \color{blue}{\mathsf{fma}\left(x, 2, y\right)}\right)} \]
    9. Applied egg-rr52.6%

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

        \[\leadsto \color{blue}{\frac{x}{x + \left(y + 1\right)} \cdot \frac{y}{y \cdot \mathsf{fma}\left(x, 2, y\right)}} \]
      2. associate-/r*82.4%

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{fma}\left(x, 2, y\right)} \cdot \color{blue}{\frac{1}{\frac{x + \left(y + 1\right)}{x}}} \]
      3. un-div-inv82.5%

        \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(x, 2, y\right)}}{\frac{x + \left(y + 1\right)}{x}}} \]
    13. Applied egg-rr82.5%

      \[\leadsto \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(x, 2, y\right)}}{\frac{x + \left(y + 1\right)}{x}}} \]
    14. Taylor expanded in x around 0 80.8%

      \[\leadsto \frac{\color{blue}{\frac{1}{y}}}{\frac{x + \left(y + 1\right)}{x}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 8: 81.1% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 6.8 \cdot 10^{-112}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-24} \lor \neg \left(y \leq 4200000\right):\\ \;\;\;\;\frac{\frac{x}{y}}{x + \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 6.8e-112)
   (/ (/ y (+ x 1.0)) x)
   (if (or (<= y 5.2e-24) (not (<= y 4200000.0)))
     (/ (/ x y) (+ x (+ y 1.0)))
     (/ (/ y x) (+ x 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 6.8e-112) {
		tmp = (y / (x + 1.0)) / x;
	} else if ((y <= 5.2e-24) || !(y <= 4200000.0)) {
		tmp = (x / y) / (x + (y + 1.0));
	} else {
		tmp = (y / x) / (x + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order 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 <= 6.8d-112) then
        tmp = (y / (x + 1.0d0)) / x
    else if ((y <= 5.2d-24) .or. (.not. (y <= 4200000.0d0))) then
        tmp = (x / y) / (x + (y + 1.0d0))
    else
        tmp = (y / x) / (x + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 6.8e-112) {
		tmp = (y / (x + 1.0)) / x;
	} else if ((y <= 5.2e-24) || !(y <= 4200000.0)) {
		tmp = (x / y) / (x + (y + 1.0));
	} else {
		tmp = (y / x) / (x + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 6.8e-112:
		tmp = (y / (x + 1.0)) / x
	elif (y <= 5.2e-24) or not (y <= 4200000.0):
		tmp = (x / y) / (x + (y + 1.0))
	else:
		tmp = (y / x) / (x + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 6.8e-112)
		tmp = Float64(Float64(y / Float64(x + 1.0)) / x);
	elseif ((y <= 5.2e-24) || !(y <= 4200000.0))
		tmp = Float64(Float64(x / y) / Float64(x + Float64(y + 1.0)));
	else
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 6.8e-112)
		tmp = (y / (x + 1.0)) / x;
	elseif ((y <= 5.2e-24) || ~((y <= 4200000.0)))
		tmp = (x / y) / (x + (y + 1.0));
	else
		tmp = (y / x) / (x + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 6.8e-112], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[Or[LessEqual[y, 5.2e-24], N[Not[LessEqual[y, 4200000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.8 \cdot 10^{-112}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\

\mathbf{elif}\;y \leq 5.2 \cdot 10^{-24} \lor \neg \left(y \leq 4200000\right):\\
\;\;\;\;\frac{\frac{x}{y}}{x + \left(y + 1\right)}\\

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


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

    1. Initial program 72.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 72.4%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(x + 1\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity60.2%

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

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{y}{x + 1}} \]
    9. Step-by-step derivation
      1. associate-*l/60.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x + 1}}{x}} \]
      2. *-lft-identity60.1%

        \[\leadsto \frac{\color{blue}{\frac{y}{x + 1}}}{x} \]
    10. Simplified60.1%

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

    if 6.7999999999999996e-112 < y < 5.2e-24 or 4.2e6 < y

    1. Initial program 61.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{x + \left(y + 1\right)} \cdot \frac{y}{y \cdot \mathsf{fma}\left(x, 2, y\right)}} \]
      2. associate-/r*75.7%

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

        \[\leadsto \frac{x}{x + \left(y + 1\right)} \cdot \frac{\color{blue}{1}}{\mathsf{fma}\left(x, 2, y\right)} \]
    11. Simplified75.7%

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{x}{\mathsf{fma}\left(x, 2, y\right)}}{x + \left(y + 1\right)}} \]
    14. Taylor expanded in x around 0 74.2%

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

    if 5.2e-24 < y < 4.2e6

    1. Initial program 97.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*97.4%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*72.2%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative72.2%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified72.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 6.8 \cdot 10^{-112}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-24} \lor \neg \left(y \leq 4200000\right):\\ \;\;\;\;\frac{\frac{x}{y}}{x + \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 80.9% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 6.8 \cdot 10^{-112}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x}\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 3200000:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 6.8e-112)
   (/ (/ y (+ x 1.0)) x)
   (if (<= y 4.4e-24)
     (/ x y)
     (if (<= y 3200000.0) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 6.8e-112) {
		tmp = (y / (x + 1.0)) / x;
	} else if (y <= 4.4e-24) {
		tmp = x / y;
	} else if (y <= 3200000.0) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order 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 <= 6.8d-112) then
        tmp = (y / (x + 1.0d0)) / x
    else if (y <= 4.4d-24) then
        tmp = x / y
    else if (y <= 3200000.0d0) then
        tmp = (y / x) / (x + 1.0d0)
    else
        tmp = (x / y) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 6.8e-112) {
		tmp = (y / (x + 1.0)) / x;
	} else if (y <= 4.4e-24) {
		tmp = x / y;
	} else if (y <= 3200000.0) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 6.8e-112:
		tmp = (y / (x + 1.0)) / x
	elif y <= 4.4e-24:
		tmp = x / y
	elif y <= 3200000.0:
		tmp = (y / x) / (x + 1.0)
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 6.8e-112)
		tmp = Float64(Float64(y / Float64(x + 1.0)) / x);
	elseif (y <= 4.4e-24)
		tmp = Float64(x / y);
	elseif (y <= 3200000.0)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 6.8e-112)
		tmp = (y / (x + 1.0)) / x;
	elseif (y <= 4.4e-24)
		tmp = x / y;
	elseif (y <= 3200000.0)
		tmp = (y / x) / (x + 1.0);
	else
		tmp = (x / y) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 6.8e-112], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 4.4e-24], N[(x / y), $MachinePrecision], If[LessEqual[y, 3200000.0], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.8 \cdot 10^{-112}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x}\\

\mathbf{elif}\;y \leq 4.4 \cdot 10^{-24}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;y \leq 3200000:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 6.7999999999999996e-112

    1. Initial program 72.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 72.4%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(x + 1\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity60.2%

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

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{y}{x + 1}} \]
    9. Step-by-step derivation
      1. associate-*l/60.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x + 1}}{x}} \]
      2. *-lft-identity60.1%

        \[\leadsto \frac{\color{blue}{\frac{y}{x + 1}}}{x} \]
    10. Simplified60.1%

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

    if 6.7999999999999996e-112 < y < 4.40000000000000003e-24

    1. Initial program 99.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*96.7%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified96.7%

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

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

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified32.3%

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

      \[\leadsto \color{blue}{\frac{x}{y}} \]

    if 4.40000000000000003e-24 < y < 3.2e6

    1. Initial program 97.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*97.4%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*72.2%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative72.2%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified72.2%

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

    if 3.2e6 < y

    1. Initial program 55.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*77.7%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified77.7%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity74.3%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y + 1} \cdot \frac{x}{y}} \]
    10. Step-by-step derivation
      1. associate-*l/80.5%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{y}}{y + 1}} \]
      2. *-un-lft-identity80.5%

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y + 1} \]
    11. Applied egg-rr80.5%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y + 1}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 10: 81.0% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{\frac{y}{x}}{x + 1}\\ \mathbf{if}\;y \leq 6.5 \cdot 10^{-112}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-24}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 45000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (/ y x) (+ x 1.0))))
   (if (<= y 6.5e-112)
     t_0
     (if (<= y 5e-24) (/ x y) (if (<= y 45000.0) t_0 (/ (/ x y) (+ y 1.0)))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = (y / x) / (x + 1.0);
	double tmp;
	if (y <= 6.5e-112) {
		tmp = t_0;
	} else if (y <= 5e-24) {
		tmp = x / y;
	} else if (y <= 45000.0) {
		tmp = t_0;
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order 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 / x) / (x + 1.0d0)
    if (y <= 6.5d-112) then
        tmp = t_0
    else if (y <= 5d-24) then
        tmp = x / y
    else if (y <= 45000.0d0) then
        tmp = t_0
    else
        tmp = (x / y) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = (y / x) / (x + 1.0);
	double tmp;
	if (y <= 6.5e-112) {
		tmp = t_0;
	} else if (y <= 5e-24) {
		tmp = x / y;
	} else if (y <= 45000.0) {
		tmp = t_0;
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = (y / x) / (x + 1.0)
	tmp = 0
	if y <= 6.5e-112:
		tmp = t_0
	elif y <= 5e-24:
		tmp = x / y
	elif y <= 45000.0:
		tmp = t_0
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(Float64(y / x) / Float64(x + 1.0))
	tmp = 0.0
	if (y <= 6.5e-112)
		tmp = t_0;
	elseif (y <= 5e-24)
		tmp = Float64(x / y);
	elseif (y <= 45000.0)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = (y / x) / (x + 1.0);
	tmp = 0.0;
	if (y <= 6.5e-112)
		tmp = t_0;
	elseif (y <= 5e-24)
		tmp = x / y;
	elseif (y <= 45000.0)
		tmp = t_0;
	else
		tmp = (x / y) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 6.5e-112], t$95$0, If[LessEqual[y, 5e-24], N[(x / y), $MachinePrecision], If[LessEqual[y, 45000.0], t$95$0, N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{x}}{x + 1}\\
\mathbf{if}\;y \leq 6.5 \cdot 10^{-112}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 5 \cdot 10^{-24}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;y \leq 45000:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 6.49999999999999956e-112 or 4.9999999999999998e-24 < y < 45000

    1. Initial program 73.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*85.7%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified85.7%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*60.6%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative60.6%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified60.6%

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

    if 6.49999999999999956e-112 < y < 4.9999999999999998e-24

    1. Initial program 99.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*96.7%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified96.7%

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

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

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified32.3%

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

      \[\leadsto \color{blue}{\frac{x}{y}} \]

    if 45000 < y

    1. Initial program 55.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*77.7%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified77.7%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity74.3%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y + 1} \cdot \frac{x}{y}} \]
    10. Step-by-step derivation
      1. associate-*l/80.5%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{y}}{y + 1}} \]
      2. *-un-lft-identity80.5%

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y + 1} \]
    11. Applied egg-rr80.5%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y + 1}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 11: 66.7% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 3.8 \cdot 10^{-201}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+147}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 3.8e-201)
   (/ y x)
   (if (<= y 6e+147) (/ x (* y (+ y 1.0))) (* (/ x y) (/ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 3.8e-201) {
		tmp = y / x;
	} else if (y <= 6e+147) {
		tmp = x / (y * (y + 1.0));
	} else {
		tmp = (x / y) * (1.0 / y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order 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 <= 3.8d-201) then
        tmp = y / x
    else if (y <= 6d+147) then
        tmp = x / (y * (y + 1.0d0))
    else
        tmp = (x / y) * (1.0d0 / y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 3.8e-201) {
		tmp = y / x;
	} else if (y <= 6e+147) {
		tmp = x / (y * (y + 1.0));
	} else {
		tmp = (x / y) * (1.0 / y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 3.8e-201:
		tmp = y / x
	elif y <= 6e+147:
		tmp = x / (y * (y + 1.0))
	else:
		tmp = (x / y) * (1.0 / y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 3.8e-201)
		tmp = Float64(y / x);
	elseif (y <= 6e+147)
		tmp = Float64(x / Float64(y * Float64(y + 1.0)));
	else
		tmp = Float64(Float64(x / y) * Float64(1.0 / y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 3.8e-201)
		tmp = y / x;
	elseif (y <= 6e+147)
		tmp = x / (y * (y + 1.0));
	else
		tmp = (x / y) * (1.0 / y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 3.8e-201], N[(y / x), $MachinePrecision], If[LessEqual[y, 6e+147], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.8 \cdot 10^{-201}:\\
\;\;\;\;\frac{y}{x}\\

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

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


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

    1. Initial program 72.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*84.8%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified84.8%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*59.3%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative59.3%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified59.3%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]
    8. Taylor expanded in x around 0 34.5%

      \[\leadsto \color{blue}{\frac{y}{x}} \]

    if 3.8e-201 < y < 5.99999999999999987e147

    1. Initial program 76.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*82.8%

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

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

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

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

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

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

    if 5.99999999999999987e147 < y

    1. Initial program 49.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*81.6%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified81.6%

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

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

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified81.6%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity81.6%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y + 1} \cdot \frac{x}{y}} \]
    10. Taylor expanded in y around inf 92.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.8 \cdot 10^{-201}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+147}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 65.8% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 3.8 \cdot 10^{-201}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 3.8e-201) (/ y x) (if (<= y 1.0) (/ x y) (* (/ x y) (/ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 3.8e-201) {
		tmp = y / x;
	} else if (y <= 1.0) {
		tmp = x / y;
	} else {
		tmp = (x / y) * (1.0 / y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order 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 <= 3.8d-201) then
        tmp = y / x
    else if (y <= 1.0d0) then
        tmp = x / y
    else
        tmp = (x / y) * (1.0d0 / y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 3.8e-201) {
		tmp = y / x;
	} else if (y <= 1.0) {
		tmp = x / y;
	} else {
		tmp = (x / y) * (1.0 / y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 3.8e-201:
		tmp = y / x
	elif y <= 1.0:
		tmp = x / y
	else:
		tmp = (x / y) * (1.0 / y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 3.8e-201)
		tmp = Float64(y / x);
	elseif (y <= 1.0)
		tmp = Float64(x / y);
	else
		tmp = Float64(Float64(x / y) * Float64(1.0 / y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 3.8e-201)
		tmp = y / x;
	elseif (y <= 1.0)
		tmp = x / y;
	else
		tmp = (x / y) * (1.0 / y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 3.8e-201], N[(y / x), $MachinePrecision], If[LessEqual[y, 1.0], N[(x / y), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.8 \cdot 10^{-201}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{x}{y}\\

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


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

    1. Initial program 72.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*84.8%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified84.8%

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*59.3%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative59.3%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified59.3%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]
    8. Taylor expanded in x around 0 34.5%

      \[\leadsto \color{blue}{\frac{y}{x}} \]

    if 3.8e-201 < y < 1

    1. Initial program 90.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*94.5%

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

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

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

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

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified32.6%

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

      \[\leadsto \color{blue}{\frac{x}{y}} \]

    if 1 < y

    1. Initial program 55.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*77.9%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity73.4%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y + 1} \cdot \frac{x}{y}} \]
    10. Taylor expanded in y around inf 78.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.8 \cdot 10^{-201}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 80.4% accurate, 1.4× speedup?

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

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


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

    1. Initial program 72.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*85.1%

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

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

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

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

    if 6.7999999999999996e-112 < y

    1. Initial program 63.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*81.5%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity65.8%

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

        \[\leadsto \frac{1 \cdot x}{\color{blue}{\left(y + 1\right) \cdot y}} \]
      3. times-frac70.7%

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

      \[\leadsto \color{blue}{\frac{1}{y + 1} \cdot \frac{x}{y}} \]
    10. Step-by-step derivation
      1. associate-*l/70.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{y}}{y + 1}} \]
      2. *-un-lft-identity70.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 6.8 \cdot 10^{-112}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 43.7% accurate, 2.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -3.2 \cdot 10^{-189}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (if (<= x -3.2e-189) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -3.2e-189) {
		tmp = y / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order 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 <= (-3.2d-189)) then
        tmp = y / x
    else
        tmp = x / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -3.2e-189) {
		tmp = y / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -3.2e-189:
		tmp = y / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -3.2e-189)
		tmp = Float64(y / x);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -3.2e-189)
		tmp = y / x;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -3.2e-189], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-189}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.2000000000000001e-189

    1. Initial program 65.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*80.5%

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*56.0%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative56.0%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified56.0%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]
    8. Taylor expanded in x around 0 27.1%

      \[\leadsto \color{blue}{\frac{y}{x}} \]

    if -3.2000000000000001e-189 < x

    1. Initial program 71.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*85.8%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified85.8%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 27.2% accurate, 2.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.5 \cdot 10^{+16}:\\ \;\;\;\;\frac{0.5}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (if (<= x -2.5e+16) (/ 0.5 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -2.5e+16) {
		tmp = 0.5 / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order 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 <= (-2.5d+16)) then
        tmp = 0.5d0 / x
    else
        tmp = x / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -2.5e+16) {
		tmp = 0.5 / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -2.5e+16:
		tmp = 0.5 / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -2.5e+16)
		tmp = Float64(0.5 / x);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -2.5e+16)
		tmp = 0.5 / x;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -2.5e+16], N[(0.5 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+16}:\\
\;\;\;\;\frac{0.5}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.5e16

    1. Initial program 55.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*75.9%

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\left(y \cdot \left(y + \color{blue}{x \cdot 2}\right)\right) \cdot \left(x + \left(y + 1\right)\right)} \]
    7. Simplified57.0%

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

      \[\leadsto \color{blue}{\frac{0.5}{x}} \]

    if -2.5e16 < x

    1. Initial program 74.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*86.8%

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

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified86.8%

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 16: 4.4% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{0.5}{x} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ 0.5 x))
assert(x < y);
double code(double x, double y) {
	return 0.5 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 0.5d0 / x
end function
assert x < y;
public static double code(double x, double y) {
	return 0.5 / x;
}
[x, y] = sort([x, y])
def code(x, y):
	return 0.5 / x
x, y = sort([x, y])
function code(x, y)
	return Float64(0.5 / x)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 0.5 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(0.5 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{0.5}{x}
\end{array}
Derivation
  1. Initial program 69.0%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Step-by-step derivation
    1. associate-/l*83.7%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{0.5}{x}} \]
  9. Add Preprocessing

Developer target: 99.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x / ((y + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y):
	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y)
	return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x))))
end
function tmp = code(x, y)
	tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}

Reproduce

?
herbie shell --seed 2024087 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :alt
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

  (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))