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

Percentage Accurate: 68.4% → 99.3%
Time: 16.0s
Alternatives: 19
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 19 alternatives:

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

Initial Program: 68.4% 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.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 94.5% accurate, 0.6× speedup?

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

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

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


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

    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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*66.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.29999999999999992e-5 < y < 2.11999999999999999e92

    1. Initial program 77.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*86.7%

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

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

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

    if 2.11999999999999999e92 < y

    1. Initial program 52.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. associate-*l*52.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.7% accurate, 0.6× speedup?

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

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

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


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

    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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*66.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.29999999999999992e-5 < y < 1.6e154

    1. Initial program 57.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*67.9%

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

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

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

        \[\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+67.9%

        \[\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*67.9%

        \[\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-frac92.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. +-commutative92.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. +-commutative92.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+92.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. +-commutative92.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+92.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-rr92.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/92.4%

        \[\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-identity92.4%

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

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

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

    if 1.6e154 < y

    1. Initial program 62.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. associate-*l*62.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 96.3% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.05e142

    1. Initial program 56.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.05e142 < y < 1.35000000000000003e154

    1. Initial program 66.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. associate-*l*66.2%

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

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

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

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

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

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

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

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

    if 1.35000000000000003e154 < y

    1. Initial program 62.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. associate-*l*62.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 94.1% accurate, 0.7× speedup?

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

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

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


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

    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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*66.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9000000000000001e-5 < y < 2.3e136

    1. Initial program 58.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. associate-*l*58.3%

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

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

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

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

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

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

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

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

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

    if 2.3e136 < y

    1. Initial program 60.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. associate-*l*60.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 78.9% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+29}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -1.55 \cdot 10^{-58} \lor \neg \left(x \leq -2.6 \cdot 10^{-152}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot \left(y + \left(x + 1\right)\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 (<= x -9.5e+29)
   (/ (/ y x) (+ x y))
   (if (or (<= x -1.55e-58) (not (<= x -2.6e-152)))
     (/ (/ x y) (+ y 1.0))
     (/ y (* x (+ y (+ x 1.0)))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -9.5e+29) {
		tmp = (y / x) / (x + y);
	} else if ((x <= -1.55e-58) || !(x <= -2.6e-152)) {
		tmp = (x / y) / (y + 1.0);
	} else {
		tmp = y / (x * (y + (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 <= (-9.5d+29)) then
        tmp = (y / x) / (x + y)
    else if ((x <= (-1.55d-58)) .or. (.not. (x <= (-2.6d-152)))) then
        tmp = (x / y) / (y + 1.0d0)
    else
        tmp = y / (x * (y + (x + 1.0d0)))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -9.5e+29) {
		tmp = (y / x) / (x + y);
	} else if ((x <= -1.55e-58) || !(x <= -2.6e-152)) {
		tmp = (x / y) / (y + 1.0);
	} else {
		tmp = y / (x * (y + (x + 1.0)));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -9.5e+29:
		tmp = (y / x) / (x + y)
	elif (x <= -1.55e-58) or not (x <= -2.6e-152):
		tmp = (x / y) / (y + 1.0)
	else:
		tmp = y / (x * (y + (x + 1.0)))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -9.5e+29)
		tmp = Float64(Float64(y / x) / Float64(x + y));
	elseif ((x <= -1.55e-58) || !(x <= -2.6e-152))
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	else
		tmp = Float64(y / Float64(x * Float64(y + 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 <= -9.5e+29)
		tmp = (y / x) / (x + y);
	elseif ((x <= -1.55e-58) || ~((x <= -2.6e-152)))
		tmp = (x / y) / (y + 1.0);
	else
		tmp = y / (x * (y + (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, -9.5e+29], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.55e-58], N[Not[LessEqual[x, -2.6e-152]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{+29}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\

\mathbf{elif}\;x \leq -1.55 \cdot 10^{-58} \lor \neg \left(x \leq -2.6 \cdot 10^{-152}\right):\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\

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


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

    1. Initial program 59.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. associate-*l*59.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.5000000000000003e29 < x < -1.55e-58 or -2.60000000000000013e-152 < x

    1. Initial program 64.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. associate-*l*64.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.55e-58 < x < -2.60000000000000013e-152

    1. Initial program 78.0%

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

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

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

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

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

        \[\leadsto \frac{x \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-/r*78.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+29}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -1.55 \cdot 10^{-58} \lor \neg \left(x \leq -2.6 \cdot 10^{-152}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot \left(y + \left(x + 1\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 76.3% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -3.6 \cdot 10^{+30} \lor \neg \left(x \leq -1.75 \cdot 10^{-57}\right) \land x \leq -2.6 \cdot 10^{-152}:\\ \;\;\;\;\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 (or (<= x -3.6e+30) (and (not (<= x -1.75e-57)) (<= x -2.6e-152)))
   (/ y (* x (+ x 1.0)))
   (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if ((x <= -3.6e+30) || (!(x <= -1.75e-57) && (x <= -2.6e-152))) {
		tmp = y / (x * (x + 1.0));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((x <= (-3.6d+30)) .or. (.not. (x <= (-1.75d-57))) .and. (x <= (-2.6d-152))) then
        tmp = y / (x * (x + 1.0d0))
    else
        tmp = (x / y) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if ((x <= -3.6e+30) || (!(x <= -1.75e-57) && (x <= -2.6e-152))) {
		tmp = y / (x * (x + 1.0));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if (x <= -3.6e+30) or (not (x <= -1.75e-57) and (x <= -2.6e-152)):
		tmp = y / (x * (x + 1.0))
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if ((x <= -3.6e+30) || (!(x <= -1.75e-57) && (x <= -2.6e-152)))
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -3.6e+30) || (~((x <= -1.75e-57)) && (x <= -2.6e-152)))
		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[Or[LessEqual[x, -3.6e+30], And[N[Not[LessEqual[x, -1.75e-57]], $MachinePrecision], LessEqual[x, -2.6e-152]]], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{+30} \lor \neg \left(x \leq -1.75 \cdot 10^{-57}\right) \land x \leq -2.6 \cdot 10^{-152}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.6000000000000002e30 or -1.74999999999999996e-57 < x < -2.60000000000000013e-152

    1. Initial program 64.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*74.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+74.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. Simplified74.8%

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

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

    if -3.6000000000000002e30 < x < -1.74999999999999996e-57 or -2.60000000000000013e-152 < x

    1. Initial program 64.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. associate-*l*64.3%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.6 \cdot 10^{+30} \lor \neg \left(x \leq -1.75 \cdot 10^{-57}\right) \land x \leq -2.6 \cdot 10^{-152}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 78.8% accurate, 0.8× speedup?

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

\mathbf{elif}\;x \leq -8.2 \cdot 10^{-59} \lor \neg \left(x \leq -2.6 \cdot 10^{-152}\right):\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\

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


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

    1. Initial program 59.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. associate-*l*59.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.3499999999999999e30 < x < -8.1999999999999991e-59 or -2.60000000000000013e-152 < x

    1. Initial program 64.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. associate-*l*64.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.1999999999999991e-59 < x < -2.60000000000000013e-152

    1. Initial program 78.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{+30}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -8.2 \cdot 10^{-59} \lor \neg \left(x \leq -2.6 \cdot 10^{-152}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 85.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 60.2%

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

        \[\leadsto \color{blue}{\frac{x \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.2%

        \[\leadsto \frac{x \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-/r*73.5%

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

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

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

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

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

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

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

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

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

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

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

    if -3.70000000000000023e102 < x < -3.9499999999999999e-224

    1. Initial program 72.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. associate-*l*72.5%

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

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

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

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

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

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

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

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

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

    if -3.9499999999999999e-224 < x

    1. Initial program 63.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. associate-*l*63.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 85.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 60.2%

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

        \[\leadsto \color{blue}{\frac{x \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.2%

        \[\leadsto \frac{x \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-/r*73.5%

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

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

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

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

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

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

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

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

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

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

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

    if -3.70000000000000023e102 < x < -3.9499999999999999e-224

    1. Initial program 72.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. associate-*l*72.5%

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

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

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

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

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

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

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

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

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

    if -3.9499999999999999e-224 < x

    1. Initial program 63.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. associate-*l*63.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 66.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 60.9%

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

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

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

    if 3.99999999999999977e-157 < y < 1

    1. Initial program 86.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*94.9%

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

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

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

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

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

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

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

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

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

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

    if 1 < y

    1. Initial program 59.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*59.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 67.4% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 60.9%

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

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

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

    if 1.8e-157 < y < 2.3500000000000001e66

    1. Initial program 84.2%

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

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

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

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

    if 2.3500000000000001e66 < y

    1. Initial program 52.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*52.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 79.8% accurate, 1.0× speedup?

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

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

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


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

    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*75.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+75.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. Simplified75.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 59.4%

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

    if -2.60000000000000013e-152 < x < 6.99999999999999961e-10

    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*81.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+81.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. Simplified81.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 78.6%

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

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

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

    if 6.99999999999999961e-10 < x

    1. Initial program 59.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. associate-*l*59.6%

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 82.0% accurate, 1.1× speedup?

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

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


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

    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*75.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+75.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. Simplified75.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. Step-by-step derivation
      1. associate-*r/65.4%

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

        \[\leadsto \frac{x \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-/r*76.3%

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

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

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

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

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

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

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

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

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

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

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

    if -2.60000000000000013e-152 < x

    1. Initial program 63.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. associate-*l*63.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 82.4% accurate, 1.2× speedup?

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

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


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

    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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*65.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8e-152 < x

    1. Initial program 63.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. associate-*l*63.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 82.2% accurate, 1.4× speedup?

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

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


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

    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*75.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+75.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. Simplified75.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 59.4%

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

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

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

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

    if -2.60000000000000013e-152 < x

    1. Initial program 63.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. associate-*l*63.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 43.8% accurate, 1.7× speedup?

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

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


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

    1. Initial program 66.2%

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

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

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

    if -3.1999999999999997e-197 < x

    1. Initial program 63.3%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 18: 4.4% accurate, 5.7× speedup?

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

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

      \[\leadsto \frac{x \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-/r*71.5%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  9. Final simplification4.2%

    \[\leadsto \frac{1}{x} \]
  10. Add Preprocessing

Alternative 19: 26.4% accurate, 5.7× speedup?

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

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

    \[\leadsto \color{blue}{\frac{y}{x}} \]
  7. Final simplification28.1%

    \[\leadsto \frac{y}{x} \]
  8. 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 2024082 
(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))))