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

Percentage Accurate: 69.2% → 99.8%
Time: 12.6s
Alternatives: 18
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 18 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.2% 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{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{y + x}}{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 (+ y 1.0))) (/ x (+ y x))) (+ y x)))
assert(x < y);
double code(double x, double y) {
	return ((y / (x + (y + 1.0))) * (x / (y + x))) / (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 + (y + 1.0d0))) * (x / (y + x))) / (y + x)
end function
assert x < y;
public static double code(double x, double y) {
	return ((y / (x + (y + 1.0))) * (x / (y + x))) / (y + x);
}
[x, y] = sort([x, y])
def code(x, y):
	return ((y / (x + (y + 1.0))) * (x / (y + x))) / (y + x)
x, y = sort([x, y])
function code(x, y)
	return Float64(Float64(Float64(y / Float64(x + Float64(y + 1.0))) * Float64(x / Float64(y + x))) / Float64(y + x))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = ((y / (x + (y + 1.0))) * (x / (y + x))) / (y + x);
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{y + x}}{y + x}
\end{array}
Derivation
  1. Initial program 66.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. Add Preprocessing
  3. Step-by-step derivation
    1. *-un-lft-identity66.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 91.9% accurate, 0.6× speedup?

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

\mathbf{elif}\;x \leq -5.5 \cdot 10^{+32} \lor \neg \left(x \leq -0.185\right):\\
\;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{y + 1}}{y + x}\\

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


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

    1. Initial program 50.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity50.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.04999999999999993e54 < x < -5.49999999999999984e32 or -0.185 < x

    1. Initial program 70.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity70.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{y}{1 + y}} \cdot \frac{x}{y + x}}{y + x} \]
    10. Step-by-step derivation
      1. +-commutative80.9%

        \[\leadsto \frac{\frac{y}{\color{blue}{y + 1}} \cdot \frac{x}{y + x}}{y + x} \]
    11. Simplified80.9%

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

    if -5.49999999999999984e32 < x < -0.185

    1. Initial program 76.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity76.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{y + x} \cdot \frac{y}{\color{blue}{x + 1}} \]
    7. Simplified52.4%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{y + x} \cdot y}{x + 1}} \]
      2. associate-*l/52.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.05 \cdot 10^{+54}:\\ \;\;\;\;\frac{1}{y + x} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{+32} \lor \neg \left(x \leq -0.185\right):\\ \;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{y + 1}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{x + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 94.5% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 50.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity50.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.0999999999999999e64 < x < -1.85000000000000001e-14

    1. Initial program 85.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. Add Preprocessing

    if -1.85000000000000001e-14 < x

    1. Initial program 69.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity69.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{y}{\color{blue}{y + 1}} \cdot \frac{x}{y + x}}{y + x} \]
    11. Simplified80.5%

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

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

Alternative 4: 94.8% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 50.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity50.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.59999999999999997e64 < x < -8.79999999999999974e-45

    1. Initial program 85.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.79999999999999974e-45 < x

    1. Initial program 68.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 94.2% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 50.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity50.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.0999999999999999e64 < x < -4.9999999999999999e-20

    1. Initial program 86.1%

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

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

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

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

    if -4.9999999999999999e-20 < x

    1. Initial program 69.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity69.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{y}{1 + y}} \cdot \frac{x}{y + x}}{y + x} \]
    10. Step-by-step derivation
      1. +-commutative80.4%

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

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

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

Alternative 6: 83.8% accurate, 0.7× speedup?

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

\mathbf{elif}\;y \leq 1.55 \cdot 10^{+66}:\\
\;\;\;\;\frac{1}{y + x} \cdot \frac{x}{y + 1}\\

\mathbf{elif}\;y \leq 3.4 \cdot 10^{+141}:\\
\;\;\;\;x \cdot \frac{\frac{1}{y}}{y + x}\\

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


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

    1. Initial program 66.3%

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

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

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

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

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

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

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

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

    if 2.5000000000000001e-85 < y < 1.55000000000000009e66

    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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity91.2%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{y + x} \cdot \color{blue}{\frac{x}{1 + y}} \]
    6. Step-by-step derivation
      1. +-commutative47.0%

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

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

    if 1.55000000000000009e66 < y < 3.3999999999999998e141

    1. Initial program 45.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*61.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. associate-+l+61.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.3999999999999998e141 < y

    1. Initial program 58.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity58.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.5 \cdot 10^{-85}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{+66}:\\ \;\;\;\;\frac{1}{y + x} \cdot \frac{x}{y + 1}\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{+141}:\\ \;\;\;\;x \cdot \frac{\frac{1}{y}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{y + x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 83.6% accurate, 0.7× speedup?

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

\mathbf{elif}\;y \leq 2 \cdot 10^{+65}:\\
\;\;\;\;\frac{1}{y + x} \cdot \frac{x}{y + 1}\\

\mathbf{elif}\;y \leq 1.76 \cdot 10^{+158}:\\
\;\;\;\;x \cdot \frac{\frac{1}{y}}{y + x}\\

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


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

    1. Initial program 66.3%

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

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

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

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

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

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

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

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

    if 2.80000000000000017e-85 < y < 2e65

    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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity91.2%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{y + x} \cdot \color{blue}{\frac{x}{1 + y}} \]
    6. Step-by-step derivation
      1. +-commutative47.0%

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

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

    if 2e65 < y < 1.7600000000000001e158

    1. Initial program 47.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.7600000000000001e158 < y

    1. Initial program 60.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity60.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y + x} \]
      3. clear-num86.6%

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

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

Alternative 8: 83.6% accurate, 0.7× speedup?

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

\mathbf{elif}\;y \leq 4.9 \cdot 10^{+38}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\

\mathbf{elif}\;y \leq 1.62 \cdot 10^{+159}:\\
\;\;\;\;x \cdot \frac{\frac{1}{y}}{y + x}\\

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


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

    1. Initial program 66.3%

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

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

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

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

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

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

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

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

    if 2.80000000000000017e-85 < y < 4.90000000000000002e38

    1. Initial program 93.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*99.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. associate-+l+99.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y + 1}}}{y} \]
    11. Simplified44.5%

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

    if 4.90000000000000002e38 < y < 1.62e159

    1. Initial program 49.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.62e159 < y

    1. Initial program 60.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity60.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y + x} \]
      3. clear-num86.6%

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

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

Alternative 9: 83.7% accurate, 0.7× speedup?

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

\mathbf{elif}\;y \leq 4.9 \cdot 10^{+38}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\

\mathbf{elif}\;y \leq 3.5 \cdot 10^{+134}:\\
\;\;\;\;x \cdot \frac{\frac{1}{y}}{y + x}\\

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


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

    1. Initial program 66.3%

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

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

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

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

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

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

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

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

    if 1.36e-85 < y < 4.90000000000000002e38

    1. Initial program 93.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*99.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. associate-+l+99.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y + 1}}}{y} \]
    11. Simplified44.5%

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

    if 4.90000000000000002e38 < y < 3.50000000000000003e134

    1. Initial program 46.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.50000000000000003e134 < y

    1. Initial program 58.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity58.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{y + x} \cdot \color{blue}{\frac{x}{y}} \]
    8. Step-by-step derivation
      1. *-commutative80.9%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y + x}} \]
      2. associate-*l/80.9%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{1}{y + x}}{y}} \]
      3. div-inv80.9%

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

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

Alternative 10: 82.9% accurate, 1.4× speedup?

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

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


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

    1. Initial program 66.3%

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

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

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

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

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

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

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

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

    if 2.02000000000000013e-85 < y

    1. Initial program 67.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 81.3% accurate, 1.4× speedup?

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

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


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

    1. Initial program 66.3%

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

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

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

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

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

    if 1.36e-85 < y

    1. Initial program 67.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 81.3% accurate, 1.4× speedup?

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

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


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

    1. Initial program 66.3%

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

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

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

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

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

    if 2.5000000000000001e-85 < y

    1. Initial program 67.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{x} \cdot \frac{\sqrt{x}}{y}}{y + 1}} \]
      2. associate-*r/29.9%

        \[\leadsto \frac{\color{blue}{\frac{\sqrt{x} \cdot \sqrt{x}}{y}}}{y + 1} \]
      3. add-sqr-sqrt65.9%

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

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

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

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

Alternative 13: 79.2% accurate, 1.4× speedup?

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

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


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

    1. Initial program 66.3%

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

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

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

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

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

    if 4.7000000000000001e-86 < y

    1. Initial program 67.7%

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

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

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

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

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

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

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

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

Alternative 14: 65.8% accurate, 1.4× speedup?

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

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


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

    1. Initial program 65.4%

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

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

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

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

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

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

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

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

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

    if 4.7999999999999997e-135 < y

    1. Initial program 69.0%

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

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

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

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

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

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

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

Alternative 15: 44.3% accurate, 1.4× speedup?

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

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


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

    1. Initial program 65.4%

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

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

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

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

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

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

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

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

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

    if 4.49999999999999987e-135 < y

    1. Initial program 69.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity69.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{y + x} \cdot \frac{x}{\color{blue}{y + 1}} \]
    7. Simplified61.9%

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

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

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

Alternative 16: 44.2% accurate, 2.1× speedup?

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

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


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

    1. Initial program 65.4%

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

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

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

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

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

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

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

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

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

    if 4.3999999999999999e-135 < y

    1. Initial program 69.0%

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

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

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

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

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

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

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

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

Alternative 17: 26.1% accurate, 5.7× speedup?

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

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

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

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

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

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

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

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

Alternative 18: 4.0% accurate, 5.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{y}} \]
  9. Add Preprocessing

Developer target: 99.8% accurate, 0.9× speedup?

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

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

Reproduce

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

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

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