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

Percentage Accurate: 69.3% → 99.8%
Time: 16.7s
Alternatives: 20
Speedup: 1.9×

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 20 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: 69.3% 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: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{x + y} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (* (/ x (+ x y)) (/ (/ y (+ x (+ y 1.0))) (+ x y))))
assert(x < y);
double code(double x, double y) {
	return (x / (x + y)) * ((y / (x + (y + 1.0))) / (x + y));
}
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 = (x / (x + y)) * ((y / (x + (y + 1.0d0))) / (x + y))
end function
assert x < y;
public static double code(double x, double y) {
	return (x / (x + y)) * ((y / (x + (y + 1.0))) / (x + y));
}
[x, y] = sort([x, y])
def code(x, y):
	return (x / (x + y)) * ((y / (x + (y + 1.0))) / (x + y))
x, y = sort([x, y])
function code(x, y)
	return Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(x + Float64(y + 1.0))) / Float64(x + y)))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = (x / (x + y)) * ((y / (x + (y + 1.0))) / (x + y));
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{x + y} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y}
\end{array}
Derivation
  1. Initial program 74.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. times-frac89.3%

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

      \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. associate-*l/86.0%

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

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

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

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

Alternative 2: 85.7% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{x}{\left(x + y\right) \cdot \left(y + \left(x + \left(x + 1\right)\right)\right)}\\ \mathbf{if}\;y \leq 3.4 \cdot 10^{-74}:\\ \;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x + y}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.29:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;y \leq 2.25 \cdot 10^{+136}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{1}{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
 (let* ((t_0 (/ x (* (+ x y) (+ y (+ x (+ x 1.0)))))))
   (if (<= y 3.4e-74)
     (/ (/ y (+ x (+ y 1.0))) (+ x y))
     (if (<= y 1.4e-7)
       t_0
       (if (<= y 0.29)
         (/ y (* x x))
         (if (<= y 2.25e+136) t_0 (* (/ x (+ x y)) (/ 1.0 (+ x y)))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = x / ((x + y) * (y + (x + (x + 1.0))));
	double tmp;
	if (y <= 3.4e-74) {
		tmp = (y / (x + (y + 1.0))) / (x + y);
	} else if (y <= 1.4e-7) {
		tmp = t_0;
	} else if (y <= 0.29) {
		tmp = y / (x * x);
	} else if (y <= 2.25e+136) {
		tmp = t_0;
	} else {
		tmp = (x / (x + y)) * (1.0 / (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) :: t_0
    real(8) :: tmp
    t_0 = x / ((x + y) * (y + (x + (x + 1.0d0))))
    if (y <= 3.4d-74) then
        tmp = (y / (x + (y + 1.0d0))) / (x + y)
    else if (y <= 1.4d-7) then
        tmp = t_0
    else if (y <= 0.29d0) then
        tmp = y / (x * x)
    else if (y <= 2.25d+136) then
        tmp = t_0
    else
        tmp = (x / (x + y)) * (1.0d0 / (x + y))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = x / ((x + y) * (y + (x + (x + 1.0))));
	double tmp;
	if (y <= 3.4e-74) {
		tmp = (y / (x + (y + 1.0))) / (x + y);
	} else if (y <= 1.4e-7) {
		tmp = t_0;
	} else if (y <= 0.29) {
		tmp = y / (x * x);
	} else if (y <= 2.25e+136) {
		tmp = t_0;
	} else {
		tmp = (x / (x + y)) * (1.0 / (x + y));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = x / ((x + y) * (y + (x + (x + 1.0))))
	tmp = 0
	if y <= 3.4e-74:
		tmp = (y / (x + (y + 1.0))) / (x + y)
	elif y <= 1.4e-7:
		tmp = t_0
	elif y <= 0.29:
		tmp = y / (x * x)
	elif y <= 2.25e+136:
		tmp = t_0
	else:
		tmp = (x / (x + y)) * (1.0 / (x + y))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(x / Float64(Float64(x + y) * Float64(y + Float64(x + Float64(x + 1.0)))))
	tmp = 0.0
	if (y <= 3.4e-74)
		tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / Float64(x + y));
	elseif (y <= 1.4e-7)
		tmp = t_0;
	elseif (y <= 0.29)
		tmp = Float64(y / Float64(x * x));
	elseif (y <= 2.25e+136)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / Float64(x + y)) * Float64(1.0 / Float64(x + y)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = x / ((x + y) * (y + (x + (x + 1.0))));
	tmp = 0.0;
	if (y <= 3.4e-74)
		tmp = (y / (x + (y + 1.0))) / (x + y);
	elseif (y <= 1.4e-7)
		tmp = t_0;
	elseif (y <= 0.29)
		tmp = y / (x * x);
	elseif (y <= 2.25e+136)
		tmp = t_0;
	else
		tmp = (x / (x + y)) * (1.0 / (x + 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[(N[(x + y), $MachinePrecision] * N[(y + N[(x + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 3.4e-74], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e-7], t$95$0, If[LessEqual[y, 0.29], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.25e+136], t$95$0, N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{\left(x + y\right) \cdot \left(y + \left(x + \left(x + 1\right)\right)\right)}\\
\mathbf{if}\;y \leq 3.4 \cdot 10^{-74}:\\
\;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x + y}\\

\mathbf{elif}\;y \leq 1.4 \cdot 10^{-7}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 0.29:\\
\;\;\;\;\frac{y}{x \cdot x}\\

\mathbf{elif}\;y \leq 2.25 \cdot 10^{+136}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 75.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. times-frac90.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{x}{x + y} \cdot \frac{1}{x + y}\right)} \cdot \frac{y}{x + \left(y + 1\right)} \]
    5. Applied egg-rr99.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{y}{x + \left(y + 1\right)}}{\color{blue}{x + y}} \]
    10. Applied egg-rr69.0%

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

    if 3.4000000000000001e-74 < y < 1.4000000000000001e-7 or 0.28999999999999998 < y < 2.25e136

    1. Initial program 84.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. times-frac96.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{\left(y + x\right) \cdot \left(y - \left(\left(\color{blue}{-1} + -1 \cdot x\right) - x\right)\right)} \]
      7. neg-mul-184.5%

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

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

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

    if 1.4000000000000001e-7 < y < 0.28999999999999998

    1. Initial program 37.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-*r/37.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. *-commutative37.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{{x}^{2}}} \]
    5. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto \frac{y}{\color{blue}{x \cdot x}} \]
    6. Simplified100.0%

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

    if 2.25e136 < y

    1. Initial program 61.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. times-frac79.3%

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/79.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.4 \cdot 10^{-74}:\\ \;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x + y}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-7}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(y + \left(x + \left(x + 1\right)\right)\right)}\\ \mathbf{elif}\;y \leq 0.29:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;y \leq 2.25 \cdot 10^{+136}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(y + \left(x + \left(x + 1\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{1}{x + y}\\ \end{array} \]

Alternative 3: 86.1% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{\frac{y}{x + \left(y + 1\right)}}{x + y}\\ \mathbf{if}\;y \leq 6.6 \cdot 10^{-73}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{-7}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(y + \left(x + \left(x + 1\right)\right)\right)}\\ \mathbf{elif}\;y \leq 0.142:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \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
 (let* ((t_0 (/ (/ y (+ x (+ y 1.0))) (+ x y))))
   (if (<= y 6.6e-73)
     t_0
     (if (<= y 2.9e-7)
       (/ x (* (+ x y) (+ y (+ x (+ x 1.0)))))
       (if (<= y 0.142) (/ y (* x x)) (* t_0 (/ x y)))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = (y / (x + (y + 1.0))) / (x + y);
	double tmp;
	if (y <= 6.6e-73) {
		tmp = t_0;
	} else if (y <= 2.9e-7) {
		tmp = x / ((x + y) * (y + (x + (x + 1.0))));
	} else if (y <= 0.142) {
		tmp = y / (x * x);
	} else {
		tmp = t_0 * (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) :: t_0
    real(8) :: tmp
    t_0 = (y / (x + (y + 1.0d0))) / (x + y)
    if (y <= 6.6d-73) then
        tmp = t_0
    else if (y <= 2.9d-7) then
        tmp = x / ((x + y) * (y + (x + (x + 1.0d0))))
    else if (y <= 0.142d0) then
        tmp = y / (x * x)
    else
        tmp = t_0 * (x / y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = (y / (x + (y + 1.0))) / (x + y);
	double tmp;
	if (y <= 6.6e-73) {
		tmp = t_0;
	} else if (y <= 2.9e-7) {
		tmp = x / ((x + y) * (y + (x + (x + 1.0))));
	} else if (y <= 0.142) {
		tmp = y / (x * x);
	} else {
		tmp = t_0 * (x / y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = (y / (x + (y + 1.0))) / (x + y)
	tmp = 0
	if y <= 6.6e-73:
		tmp = t_0
	elif y <= 2.9e-7:
		tmp = x / ((x + y) * (y + (x + (x + 1.0))))
	elif y <= 0.142:
		tmp = y / (x * x)
	else:
		tmp = t_0 * (x / y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / Float64(x + y))
	tmp = 0.0
	if (y <= 6.6e-73)
		tmp = t_0;
	elseif (y <= 2.9e-7)
		tmp = Float64(x / Float64(Float64(x + y) * Float64(y + Float64(x + Float64(x + 1.0)))));
	elseif (y <= 0.142)
		tmp = Float64(y / Float64(x * x));
	else
		tmp = Float64(t_0 * Float64(x / y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = (y / (x + (y + 1.0))) / (x + y);
	tmp = 0.0;
	if (y <= 6.6e-73)
		tmp = t_0;
	elseif (y <= 2.9e-7)
		tmp = x / ((x + y) * (y + (x + (x + 1.0))));
	elseif (y <= 0.142)
		tmp = y / (x * x);
	else
		tmp = t_0 * (x / 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[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 6.6e-73], t$95$0, If[LessEqual[y, 2.9e-7], N[(x / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.142], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(x / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{x + \left(y + 1\right)}}{x + y}\\
\mathbf{if}\;y \leq 6.6 \cdot 10^{-73}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;y \leq 0.142:\\
\;\;\;\;\frac{y}{x \cdot x}\\

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


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

    1. Initial program 75.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. times-frac90.0%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{x}{x + y} \cdot \frac{1}{x + y}\right)} \cdot \frac{y}{x + \left(y + 1\right)} \]
    5. Applied egg-rr99.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{y}{x + \left(y + 1\right)}}{\color{blue}{x + y}} \]
    10. Applied egg-rr69.0%

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

    if 6.60000000000000007e-73 < y < 2.8999999999999998e-7

    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. times-frac99.3%

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/99.5%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{y + \color{blue}{\left(x + 1\right)}}{y}\right)} \]
    5. Applied egg-rr99.8%

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{\left(y + x\right) \cdot \left(y - \left(\left(\color{blue}{-1} + -1 \cdot x\right) - x\right)\right)} \]
      7. neg-mul-190.4%

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

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

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

    if 2.8999999999999998e-7 < y < 0.141999999999999987

    1. Initial program 37.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-*r/37.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. *-commutative37.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{{x}^{2}}} \]
    5. Step-by-step derivation
      1. unpow2100.0%

        \[\leadsto \frac{y}{\color{blue}{x \cdot x}} \]
    6. Simplified100.0%

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

    if 0.141999999999999987 < y

    1. Initial program 63.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. times-frac83.6%

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/83.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 6.6 \cdot 10^{-73}:\\ \;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x + y}\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{-7}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(y + \left(x + \left(x + 1\right)\right)\right)}\\ \mathbf{elif}\;y \leq 0.142:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x + y} \cdot \frac{x}{y}\\ \end{array} \]

Alternative 4: 97.0% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x + \left(y + 1\right)}\\ \mathbf{if}\;x \leq -1.32 \cdot 10^{+154}:\\ \;\;\;\;t_0 \cdot \frac{1}{x + y}\\ \mathbf{elif}\;x \leq -1 \cdot 10^{-16}:\\ \;\;\;\;t_0 \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{y + 1}}{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
 (let* ((t_0 (/ y (+ x (+ y 1.0)))))
   (if (<= x -1.32e+154)
     (* t_0 (/ 1.0 (+ x y)))
     (if (<= x -1e-16)
       (* t_0 (/ x (* (+ x y) (+ x y))))
       (* (/ x (+ x y)) (/ (/ y (+ y 1.0)) (+ x y)))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x + (y + 1.0));
	double tmp;
	if (x <= -1.32e+154) {
		tmp = t_0 * (1.0 / (x + y));
	} else if (x <= -1e-16) {
		tmp = t_0 * (x / ((x + y) * (x + y)));
	} else {
		tmp = (x / (x + y)) * ((y / (y + 1.0)) / (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) :: t_0
    real(8) :: tmp
    t_0 = y / (x + (y + 1.0d0))
    if (x <= (-1.32d+154)) then
        tmp = t_0 * (1.0d0 / (x + y))
    else if (x <= (-1d-16)) then
        tmp = t_0 * (x / ((x + y) * (x + y)))
    else
        tmp = (x / (x + y)) * ((y / (y + 1.0d0)) / (x + y))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x + (y + 1.0));
	double tmp;
	if (x <= -1.32e+154) {
		tmp = t_0 * (1.0 / (x + y));
	} else if (x <= -1e-16) {
		tmp = t_0 * (x / ((x + y) * (x + y)));
	} else {
		tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x + (y + 1.0))
	tmp = 0
	if x <= -1.32e+154:
		tmp = t_0 * (1.0 / (x + y))
	elif x <= -1e-16:
		tmp = t_0 * (x / ((x + y) * (x + y)))
	else:
		tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x + Float64(y + 1.0)))
	tmp = 0.0
	if (x <= -1.32e+154)
		tmp = Float64(t_0 * Float64(1.0 / Float64(x + y)));
	elseif (x <= -1e-16)
		tmp = Float64(t_0 * Float64(x / Float64(Float64(x + y) * Float64(x + y))));
	else
		tmp = Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(y + 1.0)) / Float64(x + y)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x + (y + 1.0));
	tmp = 0.0;
	if (x <= -1.32e+154)
		tmp = t_0 * (1.0 / (x + y));
	elseif (x <= -1e-16)
		tmp = t_0 * (x / ((x + y) * (x + y)));
	else
		tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + 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[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.32e+154], N[(t$95$0 * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1e-16], N[(t$95$0 * N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x + \left(y + 1\right)}\\
\mathbf{if}\;x \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0 \cdot \frac{1}{x + y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.31999999999999998e154

    1. Initial program 68.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. times-frac86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.31999999999999998e154 < x < -9.9999999999999998e-17

    1. Initial program 78.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. times-frac92.2%

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

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

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

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

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

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

    if -9.9999999999999998e-17 < x

    1. Initial program 74.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. times-frac89.4%

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/84.4%

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

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

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

      \[\leadsto \frac{x}{x + y} \cdot \frac{\color{blue}{\frac{y}{1 + y}}}{x + y} \]
    5. Step-by-step derivation
      1. +-commutative77.2%

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

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

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

Alternative 5: 88.8% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -30000000000:\\ \;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -3.3 \cdot 10^{-168}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + 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 (<= x -30000000000.0)
   (* (/ y (+ x (+ y 1.0))) (/ 1.0 x))
   (if (<= x -3.3e-168)
     (* (/ x (* (+ x y) (+ x y))) (/ y (+ y 1.0)))
     (/ (/ x y) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -30000000000.0) {
		tmp = (y / (x + (y + 1.0))) * (1.0 / x);
	} else if (x <= -3.3e-168) {
		tmp = (x / ((x + y) * (x + y))) * (y / (y + 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 (x <= (-30000000000.0d0)) then
        tmp = (y / (x + (y + 1.0d0))) * (1.0d0 / x)
    else if (x <= (-3.3d-168)) then
        tmp = (x / ((x + y) * (x + y))) * (y / (y + 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 (x <= -30000000000.0) {
		tmp = (y / (x + (y + 1.0))) * (1.0 / x);
	} else if (x <= -3.3e-168) {
		tmp = (x / ((x + y) * (x + y))) * (y / (y + 1.0));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -30000000000.0:
		tmp = (y / (x + (y + 1.0))) * (1.0 / x)
	elif x <= -3.3e-168:
		tmp = (x / ((x + y) * (x + y))) * (y / (y + 1.0))
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -30000000000.0)
		tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) * Float64(1.0 / x));
	elseif (x <= -3.3e-168)
		tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(x + y))) * Float64(y / Float64(y + 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 (x <= -30000000000.0)
		tmp = (y / (x + (y + 1.0))) * (1.0 / x);
	elseif (x <= -3.3e-168)
		tmp = (x / ((x + y) * (x + y))) * (y / (y + 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[x, -30000000000.0], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.3e-168], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(y + 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}\;x \leq -30000000000:\\
\;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x}\\

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

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


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

    1. Initial program 72.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. times-frac89.5%

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

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

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

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

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

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

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

    if -3e10 < x < -3.3000000000000001e-168

    1. Initial program 86.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. times-frac97.0%

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

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

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

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

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

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

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

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

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

    if -3.3000000000000001e-168 < x

    1. Initial program 72.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. times-frac87.2%

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/83.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 73.8% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -3.25 \cdot 10^{-202}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{-179}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-84}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-10}:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{elif}\;y \leq 22500000000:\\ \;\;\;\;t_0\\ \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))))
   (if (<= y -3.25e-202)
     t_0
     (if (<= y 8.6e-179)
       (/ y x)
       (if (<= y 1.75e-84)
         t_0
         (if (<= y 5.5e-10)
           (- (/ x y) x)
           (if (<= y 22500000000.0) t_0 (* (/ x y) (/ 1.0 y)))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * x);
	double tmp;
	if (y <= -3.25e-202) {
		tmp = t_0;
	} else if (y <= 8.6e-179) {
		tmp = y / x;
	} else if (y <= 1.75e-84) {
		tmp = t_0;
	} else if (y <= 5.5e-10) {
		tmp = (x / y) - x;
	} else if (y <= 22500000000.0) {
		tmp = t_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)
    if (y <= (-3.25d-202)) then
        tmp = t_0
    else if (y <= 8.6d-179) then
        tmp = y / x
    else if (y <= 1.75d-84) then
        tmp = t_0
    else if (y <= 5.5d-10) then
        tmp = (x / y) - x
    else if (y <= 22500000000.0d0) then
        tmp = t_0
    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);
	double tmp;
	if (y <= -3.25e-202) {
		tmp = t_0;
	} else if (y <= 8.6e-179) {
		tmp = y / x;
	} else if (y <= 1.75e-84) {
		tmp = t_0;
	} else if (y <= 5.5e-10) {
		tmp = (x / y) - x;
	} else if (y <= 22500000000.0) {
		tmp = t_0;
	} else {
		tmp = (x / y) * (1.0 / y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * x)
	tmp = 0
	if y <= -3.25e-202:
		tmp = t_0
	elif y <= 8.6e-179:
		tmp = y / x
	elif y <= 1.75e-84:
		tmp = t_0
	elif y <= 5.5e-10:
		tmp = (x / y) - x
	elif y <= 22500000000.0:
		tmp = t_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 * x))
	tmp = 0.0
	if (y <= -3.25e-202)
		tmp = t_0;
	elseif (y <= 8.6e-179)
		tmp = Float64(y / x);
	elseif (y <= 1.75e-84)
		tmp = t_0;
	elseif (y <= 5.5e-10)
		tmp = Float64(Float64(x / y) - x);
	elseif (y <= 22500000000.0)
		tmp = t_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);
	tmp = 0.0;
	if (y <= -3.25e-202)
		tmp = t_0;
	elseif (y <= 8.6e-179)
		tmp = y / x;
	elseif (y <= 1.75e-84)
		tmp = t_0;
	elseif (y <= 5.5e-10)
		tmp = (x / y) - x;
	elseif (y <= 22500000000.0)
		tmp = t_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 * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.25e-202], t$95$0, If[LessEqual[y, 8.6e-179], N[(y / x), $MachinePrecision], If[LessEqual[y, 1.75e-84], t$95$0, If[LessEqual[y, 5.5e-10], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[y, 22500000000.0], t$95$0, 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 x}\\
\mathbf{if}\;y \leq -3.25 \cdot 10^{-202}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 8.6 \cdot 10^{-179}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{elif}\;y \leq 1.75 \cdot 10^{-84}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;y \leq 22500000000:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -3.24999999999999978e-202 or 8.60000000000000052e-179 < y < 1.7500000000000001e-84 or 5.4999999999999996e-10 < y < 2.25e10

    1. Initial program 76.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-*r/82.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. *-commutative82.5%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{{x}^{2}}} \]
    5. Step-by-step derivation
      1. unpow251.1%

        \[\leadsto \frac{y}{\color{blue}{x \cdot x}} \]
    6. Simplified51.1%

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

    if -3.24999999999999978e-202 < y < 8.60000000000000052e-179

    1. Initial program 71.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. times-frac84.1%

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

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

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

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

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

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

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

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

    if 1.7500000000000001e-84 < y < 5.4999999999999996e-10

    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. times-frac99.2%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{\color{blue}{y} + y \cdot y} \]
    6. Simplified49.2%

      \[\leadsto \color{blue}{\frac{x}{y + y \cdot y}} \]
    7. Taylor expanded in y around 0 49.2%

      \[\leadsto \color{blue}{\frac{x}{y} + -1 \cdot x} \]
    8. Step-by-step derivation
      1. neg-mul-149.2%

        \[\leadsto \frac{x}{y} + \color{blue}{\left(-x\right)} \]
      2. unsub-neg49.2%

        \[\leadsto \color{blue}{\frac{x}{y} - x} \]
    9. Simplified49.2%

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

    if 2.25e10 < y

    1. Initial program 62.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-*r/78.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. *-commutative78.3%

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

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

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

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified78.3%

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

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow273.7%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified73.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. associate-/r*79.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.25 \cdot 10^{-202}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{-179}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-84}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-10}:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{elif}\;y \leq 22500000000:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y}\\ \end{array} \]

Alternative 7: 83.8% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x + \left(y + 1\right)}\\ \mathbf{if}\;x \leq -1.32 \cdot 10^{+154}:\\ \;\;\;\;t_0 \cdot \frac{1}{x + y}\\ \mathbf{elif}\;x \leq -1.9:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -2.45 \cdot 10^{-55}:\\ \;\;\;\;\frac{t_0}{x + y}\\ \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 (+ y 1.0)))))
   (if (<= x -1.32e+154)
     (* t_0 (/ 1.0 (+ x y)))
     (if (<= x -1.9)
       (* (/ x (* (+ x y) (+ x y))) (/ y x))
       (if (<= x -2.45e-55) (/ t_0 (+ x y)) (/ (/ x y) (+ y 1.0)))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x + (y + 1.0));
	double tmp;
	if (x <= -1.32e+154) {
		tmp = t_0 * (1.0 / (x + y));
	} else if (x <= -1.9) {
		tmp = (x / ((x + y) * (x + y))) * (y / x);
	} else if (x <= -2.45e-55) {
		tmp = t_0 / (x + y);
	} 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 + (y + 1.0d0))
    if (x <= (-1.32d+154)) then
        tmp = t_0 * (1.0d0 / (x + y))
    else if (x <= (-1.9d0)) then
        tmp = (x / ((x + y) * (x + y))) * (y / x)
    else if (x <= (-2.45d-55)) then
        tmp = t_0 / (x + y)
    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 + (y + 1.0));
	double tmp;
	if (x <= -1.32e+154) {
		tmp = t_0 * (1.0 / (x + y));
	} else if (x <= -1.9) {
		tmp = (x / ((x + y) * (x + y))) * (y / x);
	} else if (x <= -2.45e-55) {
		tmp = t_0 / (x + y);
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x + (y + 1.0))
	tmp = 0
	if x <= -1.32e+154:
		tmp = t_0 * (1.0 / (x + y))
	elif x <= -1.9:
		tmp = (x / ((x + y) * (x + y))) * (y / x)
	elif x <= -2.45e-55:
		tmp = t_0 / (x + y)
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x + Float64(y + 1.0)))
	tmp = 0.0
	if (x <= -1.32e+154)
		tmp = Float64(t_0 * Float64(1.0 / Float64(x + y)));
	elseif (x <= -1.9)
		tmp = Float64(Float64(x / Float64(Float64(x + y) * Float64(x + y))) * Float64(y / x));
	elseif (x <= -2.45e-55)
		tmp = Float64(t_0 / Float64(x + y));
	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 + (y + 1.0));
	tmp = 0.0;
	if (x <= -1.32e+154)
		tmp = t_0 * (1.0 / (x + y));
	elseif (x <= -1.9)
		tmp = (x / ((x + y) * (x + y))) * (y / x);
	elseif (x <= -2.45e-55)
		tmp = t_0 / (x + y);
	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[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.32e+154], N[(t$95$0 * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.9], N[(N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.45e-55], N[(t$95$0 / N[(x + y), $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}
t_0 := \frac{y}{x + \left(y + 1\right)}\\
\mathbf{if}\;x \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0 \cdot \frac{1}{x + y}\\

\mathbf{elif}\;x \leq -1.9:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.31999999999999998e154

    1. Initial program 68.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. times-frac86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.31999999999999998e154 < x < -1.8999999999999999

    1. Initial program 76.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. times-frac91.7%

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

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

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

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

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

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

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

    if -1.8999999999999999 < x < -2.45000000000000018e-55

    1. Initial program 91.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. times-frac99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{y}{x + \left(y + 1\right)}}{\color{blue}{x + y}} \]
    10. Applied egg-rr65.3%

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

    if -2.45000000000000018e-55 < x

    1. Initial program 74.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. times-frac88.8%

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/84.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.32 \cdot 10^{+154}:\\ \;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x + y}\\ \mathbf{elif}\;x \leq -1.9:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -2.45 \cdot 10^{-55}:\\ \;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]

Alternative 8: 92.0% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -90000000000000:\\ \;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{y + 1}}{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 -90000000000000.0)
   (* (/ y (+ x (+ y 1.0))) (/ 1.0 x))
   (* (/ x (+ x y)) (/ (/ y (+ y 1.0)) (+ x y)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -90000000000000.0) {
		tmp = (y / (x + (y + 1.0))) * (1.0 / x);
	} else {
		tmp = (x / (x + y)) * ((y / (y + 1.0)) / (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 <= (-90000000000000.0d0)) then
        tmp = (y / (x + (y + 1.0d0))) * (1.0d0 / x)
    else
        tmp = (x / (x + y)) * ((y / (y + 1.0d0)) / (x + y))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -90000000000000.0) {
		tmp = (y / (x + (y + 1.0))) * (1.0 / x);
	} else {
		tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -90000000000000.0:
		tmp = (y / (x + (y + 1.0))) * (1.0 / x)
	else:
		tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -90000000000000.0)
		tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) * Float64(1.0 / x));
	else
		tmp = Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(y + 1.0)) / Float64(x + y)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -90000000000000.0)
		tmp = (y / (x + (y + 1.0))) * (1.0 / x);
	else
		tmp = (x / (x + y)) * ((y / (y + 1.0)) / (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, -90000000000000.0], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -90000000000000:\\
\;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x}\\

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


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

    1. Initial program 72.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. times-frac89.5%

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

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

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

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

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

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

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

    if -9e13 < x

    1. Initial program 75.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. times-frac89.2%

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/84.4%

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

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

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

      \[\leadsto \frac{x}{x + y} \cdot \frac{\color{blue}{\frac{y}{1 + y}}}{x + y} \]
    5. Step-by-step derivation
      1. +-commutative77.3%

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

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

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

Alternative 9: 82.0% accurate, 1.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{-56}:\\ \;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x + y}\\ \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 (<= x -9.5e-56)
   (* (/ y (+ x (+ y 1.0))) (/ 1.0 (+ x y)))
   (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -9.5e-56) {
		tmp = (y / (x + (y + 1.0))) * (1.0 / (x + y));
	} 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 (x <= (-9.5d-56)) then
        tmp = (y / (x + (y + 1.0d0))) * (1.0d0 / (x + y))
    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 (x <= -9.5e-56) {
		tmp = (y / (x + (y + 1.0))) * (1.0 / (x + y));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -9.5e-56:
		tmp = (y / (x + (y + 1.0))) * (1.0 / (x + y))
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -9.5e-56)
		tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) * Float64(1.0 / Float64(x + y)));
	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 (x <= -9.5e-56)
		tmp = (y / (x + (y + 1.0))) * (1.0 / (x + y));
	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[x, -9.5e-56], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + y), $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}\;x \leq -9.5 \cdot 10^{-56}:\\
\;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x + y}\\

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


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

    1. Initial program 74.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. times-frac90.2%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{x}{x + y} \cdot \frac{1}{x + y}\right)} \cdot \frac{y}{x + \left(y + 1\right)} \]
    5. Applied egg-rr99.8%

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

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

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

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

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

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

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

    if -9.4999999999999991e-56 < x

    1. Initial program 73.8%

      \[\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. times-frac88.8%

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 81.9% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-55}:\\ \;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x}\\ \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 (<= x -1.8e-55)
   (* (/ y (+ x (+ y 1.0))) (/ 1.0 x))
   (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.8e-55) {
		tmp = (y / (x + (y + 1.0))) * (1.0 / x);
	} 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 (x <= (-1.8d-55)) then
        tmp = (y / (x + (y + 1.0d0))) * (1.0d0 / x)
    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 (x <= -1.8e-55) {
		tmp = (y / (x + (y + 1.0))) * (1.0 / x);
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.8e-55:
		tmp = (y / (x + (y + 1.0))) * (1.0 / x)
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.8e-55)
		tmp = Float64(Float64(y / Float64(x + Float64(y + 1.0))) * Float64(1.0 / x));
	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 (x <= -1.8e-55)
		tmp = (y / (x + (y + 1.0))) * (1.0 / x);
	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[x, -1.8e-55], N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $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}\;x \leq -1.8 \cdot 10^{-55}:\\
\;\;\;\;\frac{y}{x + \left(y + 1\right)} \cdot \frac{1}{x}\\

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


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

    1. Initial program 74.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. times-frac90.2%

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

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

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

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

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

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

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

    if -1.8e-55 < x

    1. Initial program 73.8%

      \[\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. times-frac88.8%

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 77.9% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.2 \cdot 10^{+14}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq 10500000000000:\\ \;\;\;\;\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 (<= x -2.2e+14)
   (/ y (* x x))
   (if (<= x 10500000000000.0) (/ x (* y (+ y 1.0))) (* (/ x y) (/ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -2.2e+14) {
		tmp = y / (x * x);
	} else if (x <= 10500000000000.0) {
		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 (x <= (-2.2d+14)) then
        tmp = y / (x * x)
    else if (x <= 10500000000000.0d0) 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 (x <= -2.2e+14) {
		tmp = y / (x * x);
	} else if (x <= 10500000000000.0) {
		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 x <= -2.2e+14:
		tmp = y / (x * x)
	elif x <= 10500000000000.0:
		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 (x <= -2.2e+14)
		tmp = Float64(y / Float64(x * x));
	elseif (x <= 10500000000000.0)
		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 (x <= -2.2e+14)
		tmp = y / (x * x);
	elseif (x <= 10500000000000.0)
		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[x, -2.2e+14], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 10500000000000.0], 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}\;x \leq -2.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{y}{x \cdot x}\\

\mathbf{elif}\;x \leq 10500000000000:\\
\;\;\;\;\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 x < -2.2e14

    1. Initial program 72.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-*r/80.2%

        \[\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. *-commutative80.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{{x}^{2}}} \]
    5. Step-by-step derivation
      1. unpow280.4%

        \[\leadsto \frac{y}{\color{blue}{x \cdot x}} \]
    6. Simplified80.4%

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

    if -2.2e14 < x < 1.05e13

    1. Initial program 81.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. times-frac90.6%

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

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

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

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

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

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

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

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

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

    if 1.05e13 < x

    1. Initial program 64.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-*r/76.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. *-commutative76.5%

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

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

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

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified76.5%

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

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow224.9%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified24.9%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. associate-/r*29.3%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y}} \]
      2. div-inv29.2%

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

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

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

Alternative 12: 80.0% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.95 \cdot 10^{-55}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq 2 \cdot 10^{+16}:\\ \;\;\;\;\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 (<= x -2.95e-55)
   (/ y (* x (+ x 1.0)))
   (if (<= x 2e+16) (/ x (* y (+ y 1.0))) (* (/ x y) (/ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -2.95e-55) {
		tmp = y / (x * (x + 1.0));
	} else if (x <= 2e+16) {
		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 (x <= (-2.95d-55)) then
        tmp = y / (x * (x + 1.0d0))
    else if (x <= 2d+16) 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 (x <= -2.95e-55) {
		tmp = y / (x * (x + 1.0));
	} else if (x <= 2e+16) {
		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 x <= -2.95e-55:
		tmp = y / (x * (x + 1.0))
	elif x <= 2e+16:
		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 (x <= -2.95e-55)
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	elseif (x <= 2e+16)
		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 (x <= -2.95e-55)
		tmp = y / (x * (x + 1.0));
	elseif (x <= 2e+16)
		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[x, -2.95e-55], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e+16], 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}\;x \leq -2.95 \cdot 10^{-55}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\

\mathbf{elif}\;x \leq 2 \cdot 10^{+16}:\\
\;\;\;\;\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 x < -2.9499999999999999e-55

    1. Initial program 74.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. times-frac90.1%

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

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

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

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

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

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

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

    if -2.9499999999999999e-55 < x < 2e16

    1. Initial program 80.8%

      \[\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. times-frac90.3%

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

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

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

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

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

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

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

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

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

    if 2e16 < x

    1. Initial program 63.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-*r/76.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. *-commutative76.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow225.2%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified25.2%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. associate-/r*29.6%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y}} \]
      2. div-inv29.6%

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

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

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

Alternative 13: 81.8% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{-55}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{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 (<= x -1.9e-55) (* (/ 1.0 x) (/ y (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.9e-55) {
		tmp = (1.0 / x) * (y / (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 (x <= (-1.9d-55)) then
        tmp = (1.0d0 / x) * (y / (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 (x <= -1.9e-55) {
		tmp = (1.0 / x) * (y / (x + 1.0));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.9e-55:
		tmp = (1.0 / x) * (y / (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 (x <= -1.9e-55)
		tmp = Float64(Float64(1.0 / x) * Float64(y / 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 (x <= -1.9e-55)
		tmp = (1.0 / x) * (y / (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[x, -1.9e-55], N[(N[(1.0 / x), $MachinePrecision] * N[(y / 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}\;x \leq -1.9 \cdot 10^{-55}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x + 1}\\

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


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

    1. Initial program 74.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. times-frac90.2%

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

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

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

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

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

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

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

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

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

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

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

    if -1.8999999999999998e-55 < x

    1. Initial program 73.8%

      \[\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. times-frac88.8%

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 63.9% accurate, 1.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.28 \cdot 10^{-79}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.75:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot 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 1.28e-79) (/ y x) (if (<= y 0.75) (- (/ x y) x) (/ x (* y y)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 1.28e-79) {
		tmp = y / x;
	} else if (y <= 0.75) {
		tmp = (x / y) - x;
	} else {
		tmp = 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) :: tmp
    if (y <= 1.28d-79) then
        tmp = y / x
    else if (y <= 0.75d0) then
        tmp = (x / y) - x
    else
        tmp = x / (y * y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.28e-79) {
		tmp = y / x;
	} else if (y <= 0.75) {
		tmp = (x / y) - x;
	} else {
		tmp = x / (y * y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 1.28e-79:
		tmp = y / x
	elif y <= 0.75:
		tmp = (x / y) - x
	else:
		tmp = x / (y * y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 1.28e-79)
		tmp = Float64(y / x);
	elseif (y <= 0.75)
		tmp = Float64(Float64(x / y) - x);
	else
		tmp = Float64(x / Float64(y * y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1.28e-79)
		tmp = y / x;
	elseif (y <= 0.75)
		tmp = (x / y) - x;
	else
		tmp = 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_] := If[LessEqual[y, 1.28e-79], N[(y / x), $MachinePrecision], If[LessEqual[y, 0.75], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.28 \cdot 10^{-79}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{elif}\;y \leq 0.75:\\
\;\;\;\;\frac{x}{y} - x\\

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


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

    1. Initial program 75.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. times-frac90.0%

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

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

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

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

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

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

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

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

    if 1.28e-79 < y < 0.75

    1. Initial program 91.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. times-frac99.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{\color{blue}{y} + y \cdot y} \]
    6. Simplified44.9%

      \[\leadsto \color{blue}{\frac{x}{y + y \cdot y}} \]
    7. Taylor expanded in y around 0 44.6%

      \[\leadsto \color{blue}{\frac{x}{y} + -1 \cdot x} \]
    8. Step-by-step derivation
      1. neg-mul-144.6%

        \[\leadsto \frac{x}{y} + \color{blue}{\left(-x\right)} \]
      2. unsub-neg44.6%

        \[\leadsto \color{blue}{\frac{x}{y} - x} \]
    9. Simplified44.6%

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

    if 0.75 < y

    1. Initial program 63.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-*r/78.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. *-commutative78.9%

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

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

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

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified78.9%

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

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow271.7%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified71.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.28 \cdot 10^{-79}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.75:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]

Alternative 15: 80.0% accurate, 1.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -4.7 \cdot 10^{-56}:\\ \;\;\;\;\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 (<= x -4.7e-56) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -4.7e-56) {
		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 (x <= (-4.7d-56)) 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 (x <= -4.7e-56) {
		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 x <= -4.7e-56:
		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 (x <= -4.7e-56)
		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 (x <= -4.7e-56)
		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[x, -4.7e-56], 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}\;x \leq -4.7 \cdot 10^{-56}:\\
\;\;\;\;\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 x < -4.7e-56

    1. Initial program 74.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. times-frac90.2%

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

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

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

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

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

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

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

    if -4.7e-56 < x

    1. Initial program 73.8%

      \[\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. times-frac88.8%

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 81.8% accurate, 1.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.65 \cdot 10^{-55}:\\ \;\;\;\;\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 (<= x -1.65e-55) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.65e-55) {
		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 (x <= (-1.65d-55)) 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 (x <= -1.65e-55) {
		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 x <= -1.65e-55:
		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 (x <= -1.65e-55)
		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 (x <= -1.65e-55)
		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[x, -1.65e-55], 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}\;x \leq -1.65 \cdot 10^{-55}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

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


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

    1. Initial program 74.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. times-frac90.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.65e-55 < x

    1. Initial program 73.8%

      \[\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. times-frac88.8%

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 33.9% accurate, 2.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -7.8 \cdot 10^{-252}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - x\\ \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 -7.8e-252) (/ y x) (- (/ x y) x)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -7.8e-252) {
		tmp = y / x;
	} else {
		tmp = (x / y) - 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) :: tmp
    if (x <= (-7.8d-252)) then
        tmp = y / x
    else
        tmp = (x / y) - x
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -7.8e-252) {
		tmp = y / x;
	} else {
		tmp = (x / y) - x;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -7.8e-252:
		tmp = y / x
	else:
		tmp = (x / y) - x
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -7.8e-252)
		tmp = Float64(y / x);
	else
		tmp = Float64(Float64(x / y) - x);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -7.8e-252)
		tmp = y / x;
	else
		tmp = (x / y) - x;
	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, -7.8e-252], N[(y / x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-252}:\\
\;\;\;\;\frac{y}{x}\\

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


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

    1. Initial program 77.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. times-frac91.3%

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

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

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

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

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

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

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

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

    if -7.7999999999999998e-252 < x

    1. Initial program 70.8%

      \[\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. times-frac87.2%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{\color{blue}{y} + y \cdot y} \]
    6. Simplified49.0%

      \[\leadsto \color{blue}{\frac{x}{y + y \cdot y}} \]
    7. Taylor expanded in y around 0 13.3%

      \[\leadsto \color{blue}{\frac{x}{y} + -1 \cdot x} \]
    8. Step-by-step derivation
      1. neg-mul-113.3%

        \[\leadsto \frac{x}{y} + \color{blue}{\left(-x\right)} \]
      2. unsub-neg13.3%

        \[\leadsto \color{blue}{\frac{x}{y} - x} \]
    9. Simplified13.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.8 \cdot 10^{-252}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} - x\\ \end{array} \]

Alternative 18: 64.6% accurate, 2.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2400000000000:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot 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 -2400000000000.0) (/ y (* x x)) (/ x (* y y))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -2400000000000.0) {
		tmp = y / (x * x);
	} else {
		tmp = 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) :: tmp
    if (x <= (-2400000000000.0d0)) then
        tmp = y / (x * x)
    else
        tmp = x / (y * y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -2400000000000.0) {
		tmp = y / (x * x);
	} else {
		tmp = x / (y * y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -2400000000000.0:
		tmp = y / (x * x)
	else:
		tmp = x / (y * y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -2400000000000.0)
		tmp = Float64(y / Float64(x * x));
	else
		tmp = Float64(x / Float64(y * y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -2400000000000.0)
		tmp = y / (x * x);
	else
		tmp = 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_] := If[LessEqual[x, -2400000000000.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2400000000000:\\
\;\;\;\;\frac{y}{x \cdot x}\\

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


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

    1. Initial program 72.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-*r/80.2%

        \[\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. *-commutative80.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{{x}^{2}}} \]
    5. Step-by-step derivation
      1. unpow280.4%

        \[\leadsto \frac{y}{\color{blue}{x \cdot x}} \]
    6. Simplified80.4%

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

    if -2.4e12 < x

    1. Initial program 75.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-*r/84.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. *-commutative84.4%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow243.1%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified43.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2400000000000:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]

Alternative 19: 4.3% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{1}{x} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
	return 1.0 / 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 = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
	return 1.0 / x;
}
[x, y] = sort([x, y])
def code(x, y):
	return 1.0 / x
x, y = sort([x, y])
function code(x, y)
	return Float64(1.0 / x)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Derivation
  1. Initial program 74.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. times-frac89.3%

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

      \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. associate-*l/86.0%

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  6. Final simplification4.3%

    \[\leadsto \frac{1}{x} \]

Alternative 20: 26.0% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{y}{x} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ y x))
assert(x < y);
double code(double x, double y) {
	return y / 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 = y / x
end function
assert x < y;
public static double code(double x, double y) {
	return y / x;
}
[x, y] = sort([x, y])
def code(x, y):
	return y / x
x, y = sort([x, y])
function code(x, y)
	return Float64(y / x)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = y / x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(y / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{x}
\end{array}
Derivation
  1. Initial program 74.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. times-frac89.3%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{y}{x}} \]
  6. Final simplification26.2%

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

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 2023195 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

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