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

Percentage Accurate: 68.8% → 99.8%
Time: 15.7s
Alternatives: 17
Speedup: 1.0×

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 17 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.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 92.7% accurate, 0.6× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


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

    1. Initial program 40.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. *-commutative40.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.8e73 < x < -4.40000000000000022e-163

    1. Initial program 89.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*96.7%

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

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

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

    if -4.40000000000000022e-163 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 86.2% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 42.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative42.1%

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e164 < x < -5.0499999999999997e-138

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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. *-commutative70.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 83.2% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 42.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative42.1%

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e164 < x < -2.5e9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5e9 < x < -1.0999999999999999e-138

    1. Initial program 93.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*97.5%

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

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

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

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

    if -1.0999999999999999e-138 < x

    1. Initial program 70.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. *-commutative70.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 79.3% accurate, 0.8× speedup?

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

\mathbf{elif}\;x \leq -1.6 \cdot 10^{-9} \lor \neg \left(x \leq -5.05 \cdot 10^{-138}\right):\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\

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


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

    1. Initial program 48.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. *-commutative48.3%

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

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

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

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

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

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

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

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

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

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

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

    if -1.8e18 < x < -1.60000000000000006e-9 or -5.0499999999999997e-138 < x

    1. Initial program 71.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*83.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+83.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. Simplified83.8%

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

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

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

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

    if -1.60000000000000006e-9 < x < -5.0499999999999997e-138

    1. Initial program 94.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*99.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+99.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. Simplified99.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 53.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{+18}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{-9} \lor \neg \left(x \leq -5.05 \cdot 10^{-138}\right):\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 81.8% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 42.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative42.1%

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e164 < x < -1.55e9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.55e9 < x < -5.0499999999999997e-138

    1. Initial program 93.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*97.5%

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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*83.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+83.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. Simplified83.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 53.5%

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

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

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

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

Alternative 7: 83.2% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{+164}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -2500000000:\\ \;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\ \mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -8e+164)
   (* (/ y x) (/ 1.0 x))
   (if (<= x -2500000000.0)
     (/ y (* x (+ y x)))
     (if (<= x -5.05e-138) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -8e+164) {
		tmp = (y / x) * (1.0 / x);
	} else if (x <= -2500000000.0) {
		tmp = y / (x * (y + x));
	} else if (x <= -5.05e-138) {
		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 <= (-8d+164)) then
        tmp = (y / x) * (1.0d0 / x)
    else if (x <= (-2500000000.0d0)) then
        tmp = y / (x * (y + x))
    else if (x <= (-5.05d-138)) 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 <= -8e+164) {
		tmp = (y / x) * (1.0 / x);
	} else if (x <= -2500000000.0) {
		tmp = y / (x * (y + x));
	} else if (x <= -5.05e-138) {
		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 <= -8e+164:
		tmp = (y / x) * (1.0 / x)
	elif x <= -2500000000.0:
		tmp = y / (x * (y + x))
	elif x <= -5.05e-138:
		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 <= -8e+164)
		tmp = Float64(Float64(y / x) * Float64(1.0 / x));
	elseif (x <= -2500000000.0)
		tmp = Float64(y / Float64(x * Float64(y + x)));
	elseif (x <= -5.05e-138)
		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 <= -8e+164)
		tmp = (y / x) * (1.0 / x);
	elseif (x <= -2500000000.0)
		tmp = y / (x * (y + x));
	elseif (x <= -5.05e-138)
		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, -8e+164], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2500000000.0], N[(y / N[(x * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], 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 -8 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\

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

\mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\
\;\;\;\;\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 4 regimes
  2. if x < -8e164

    1. Initial program 42.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative42.1%

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

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

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

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

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

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

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

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

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

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

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

    if -8e164 < x < -2.5e9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5e9 < x < -5.0499999999999997e-138

    1. Initial program 93.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*97.5%

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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. *-commutative70.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 83.2% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+164}:\\ \;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -950000000:\\ \;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\ \mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -5e+164)
   (* (/ y (+ y x)) (/ 1.0 x))
   (if (<= x -950000000.0)
     (/ y (* x (+ y x)))
     (if (<= x -5.05e-138) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -5e+164) {
		tmp = (y / (y + x)) * (1.0 / x);
	} else if (x <= -950000000.0) {
		tmp = y / (x * (y + x));
	} else if (x <= -5.05e-138) {
		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 <= (-5d+164)) then
        tmp = (y / (y + x)) * (1.0d0 / x)
    else if (x <= (-950000000.0d0)) then
        tmp = y / (x * (y + x))
    else if (x <= (-5.05d-138)) 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 <= -5e+164) {
		tmp = (y / (y + x)) * (1.0 / x);
	} else if (x <= -950000000.0) {
		tmp = y / (x * (y + x));
	} else if (x <= -5.05e-138) {
		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 <= -5e+164:
		tmp = (y / (y + x)) * (1.0 / x)
	elif x <= -950000000.0:
		tmp = y / (x * (y + x))
	elif x <= -5.05e-138:
		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 <= -5e+164)
		tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x));
	elseif (x <= -950000000.0)
		tmp = Float64(y / Float64(x * Float64(y + x)));
	elseif (x <= -5.05e-138)
		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 <= -5e+164)
		tmp = (y / (y + x)) * (1.0 / x);
	elseif (x <= -950000000.0)
		tmp = y / (x * (y + x));
	elseif (x <= -5.05e-138)
		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, -5e+164], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -950000000.0], N[(y / N[(x * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], 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 -5 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\

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

\mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\
\;\;\;\;\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 4 regimes
  2. if x < -4.9999999999999995e164

    1. Initial program 42.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative42.1%

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e164 < x < -9.5e8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.5e8 < x < -5.0499999999999997e-138

    1. Initial program 93.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*97.5%

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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. *-commutative70.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 94.5% accurate, 0.8× speedup?

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

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


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

    1. Initial program 38.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. *-commutative38.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.39999999999999989e123 < x

    1. Initial program 73.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative73.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.80000000000000004e155

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

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

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

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

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

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

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

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

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

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

    if 1.80000000000000004e155 < y

    1. Initial program 67.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 87.0% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 69.3%

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

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

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

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

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

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

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

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

    if 1e-175 < y < 2.50000000000000002e154

    1. Initial program 70.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. *-commutative70.5%

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

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

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

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

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

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

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

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

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

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

    if 2.50000000000000002e154 < y

    1. Initial program 63.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. *-commutative63.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 69.3%

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

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

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

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

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

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

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

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

    if 9.5e-176 < y < 7.20000000000000015e155

    1. Initial program 68.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. *-commutative68.5%

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

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

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

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

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

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

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

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

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

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

    if 7.20000000000000015e155 < y

    1. Initial program 67.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 87.0% accurate, 0.8× speedup?

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


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

    1. Initial program 66.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. *-commutative66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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. *-commutative70.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 80.5% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 42.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative42.1%

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e164 < x < -5.0499999999999997e-138

    1. Initial program 77.2%

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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*83.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+83.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. Simplified83.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 53.5%

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

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

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

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

Alternative 15: 67.8% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 54.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. *-commutative54.5%

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

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

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

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

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

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

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

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

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

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

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

    if -1 < x < -5.0499999999999997e-138

    1. Initial program 92.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*97.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+97.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. Simplified97.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 51.8%

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

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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*83.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+83.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. Simplified83.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 53.5%

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

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

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

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

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

Alternative 16: 44.7% accurate, 2.1× speedup?

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

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


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

    1. Initial program 66.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*84.5%

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

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

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

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

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

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

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

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

    if -4.50000000000000008e-138 < x

    1. Initial program 70.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*83.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+83.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. Simplified83.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 53.5%

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

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

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

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

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

Alternative 17: 26.5% accurate, 5.7× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  9. Final simplification25.6%

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