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

Percentage Accurate: 69.1% → 99.8%
Time: 19.6s
Alternatives: 28
Speedup: 1.5×

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 28 alternatives:

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

Initial Program: 69.1% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Step-by-step derivation
    1. times-frac84.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 91.6% accurate, 0.8× speedup?

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

\mathbf{elif}\;x \leq -4.2:\\
\;\;\;\;\frac{y}{x} \cdot t_0\\

\mathbf{elif}\;x \leq -1.2 \cdot 10^{-164}:\\
\;\;\;\;t_0 \cdot \frac{y}{y + 1}\\

\mathbf{elif}\;x \leq 1.62 \cdot 10^{-211}:\\
\;\;\;\;t_1 \cdot \frac{y}{x + y}\\

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


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

    1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

    if -1.6000000000000001e162 < x < -4.20000000000000018

    1. Initial program 69.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac92.7%

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

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

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

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

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

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

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

    if -4.20000000000000018 < x < -1.19999999999999992e-164

    1. Initial program 87.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac99.7%

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

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

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

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

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

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

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

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

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

    if -1.19999999999999992e-164 < x < 1.61999999999999999e-211

    1. Initial program 53.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac69.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.61999999999999999e-211 < x

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{+162}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -4.2:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-164}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + 1}\\ \mathbf{elif}\;x \leq 1.62 \cdot 10^{-211}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{y}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{x + \left(y + \left(x + 1\right)\right)}\\ \end{array} \]

Alternative 3: 96.8% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

    if -1.79999999999999997e162 < x < -2e-16

    1. Initial program 70.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac92.9%

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

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

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

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

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

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

    if -2e-16 < x

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 85.3% accurate, 0.9× speedup?

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

\mathbf{elif}\;x \leq -3.75 \cdot 10^{+56}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\

\mathbf{elif}\;x \leq -9 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\

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

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


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

    1. Initial program 61.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac79.9%

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

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

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

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

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

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

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

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

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

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

    if -1.05e62 < x < -3.75e56

    1. Initial program 7.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity7.9%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot y} \]
      2. times-frac100.0%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
      3. inv-pow100.0%

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

      \[\leadsto \color{blue}{{y}^{-1} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. unpow-1100.0%

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

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

    if -3.75e56 < x < -8.9999999999999995e-14

    1. Initial program 83.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.9999999999999995e-14 < x < 2.74999999999999987e-211

    1. Initial program 62.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac77.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.74999999999999987e-211 < x

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.05 \cdot 10^{+62}:\\ \;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x}\\ \mathbf{elif}\;x \leq -3.75 \cdot 10^{+56}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -9 \cdot 10^{-14}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\ \mathbf{elif}\;x \leq 2.75 \cdot 10^{-211}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{y}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \]

Alternative 5: 85.3% accurate, 0.9× speedup?

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

\mathbf{elif}\;x \leq -6.2 \cdot 10^{+54}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\

\mathbf{elif}\;x \leq -7 \cdot 10^{-14}:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -3e62 or -6.1999999999999999e54 < x < -7.0000000000000005e-14

    1. Initial program 64.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac83.1%

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

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

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

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

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

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

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

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

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

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

    if -3e62 < x < -6.1999999999999999e54

    1. Initial program 7.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity7.9%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot y} \]
      2. times-frac100.0%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
      3. inv-pow100.0%

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

      \[\leadsto \color{blue}{{y}^{-1} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. unpow-1100.0%

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

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

    if -7.0000000000000005e-14 < x < 2.45000000000000016e-211

    1. Initial program 62.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac77.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.45000000000000016e-211 < x

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3 \cdot 10^{+62}:\\ \;\;\;\;\frac{\frac{y}{y + \left(x + 1\right)}}{x + y}\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{+54}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -7 \cdot 10^{-14}:\\ \;\;\;\;\frac{\frac{y}{y + \left(x + 1\right)}}{x + y}\\ \mathbf{elif}\;x \leq 2.45 \cdot 10^{-211}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{y}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \]

Alternative 6: 86.7% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

    if -1.6000000000000001e162 < x < -8.9999999999999999e-10

    1. Initial program 69.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac92.7%

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

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

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

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

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

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

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

    if -8.9999999999999999e-10 < x < 2.90000000000000014e-211

    1. Initial program 63.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.90000000000000014e-211 < x

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{x}{y + x}}{y - \left(\left(-1 - x\right) - x\right)}\right)\right)} \]
      2. expm1-udef52.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{x}{y + x}}{y - \left(\left(-1 - x\right) - x\right)}\right)} - 1} \]
      3. associate-/l/52.4%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{x}{\left(y - \color{blue}{\left(-1 - \left(x + x\right)\right)}\right) \cdot \left(y + x\right)}\right)} - 1 \]
      5. +-commutative52.4%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{x}{\left(y - \left(-1 - \left(x + x\right)\right)\right) \cdot \left(x + y\right)}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def66.3%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{+162}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -9 \cdot 10^{-10}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\ \mathbf{elif}\;x \leq 2.9 \cdot 10^{-211}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{y}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + \left(x + \left(y + 1\right)\right)}}{x + y}\\ \end{array} \]

Alternative 7: 86.5% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

    if -1.75000000000000009e162 < x < -1.70000000000000001e-14

    1. Initial program 70.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac92.9%

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

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

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

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

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

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

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

    if -1.70000000000000001e-14 < x < 1.68e-211

    1. Initial program 63.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac78.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.68e-211 < x

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 94.0% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

    if -1.62000000000000005e162 < x < -205

    1. Initial program 69.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac92.7%

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

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

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

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

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

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

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

    if -205 < x

    1. Initial program 68.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. times-frac85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 79.5% accurate, 1.0× speedup?

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

\mathbf{elif}\;x \leq -3.05 \cdot 10^{+53}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\

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

\mathbf{elif}\;x \leq -6.8 \cdot 10^{-36} \lor \neg \left(x \leq -2.45 \cdot 10^{-147}\right):\\
\;\;\;\;\frac{x}{y + y \cdot y}\\

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


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

    1. Initial program 61.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac79.9%

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

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

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

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

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

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

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

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

    if -6.5000000000000003e62 < x < -3.0500000000000001e53

    1. Initial program 7.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity7.9%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot y} \]
      2. times-frac100.0%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
      3. inv-pow100.0%

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

      \[\leadsto \color{blue}{{y}^{-1} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. unpow-1100.0%

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

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

    if -3.0500000000000001e53 < x < -1.2e-21

    1. Initial program 83.8%

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

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

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

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

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

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

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

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

    if -1.2e-21 < x < -6.8000000000000005e-36 or -2.45000000000000002e-147 < x

    1. Initial program 66.8%

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

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

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

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

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

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

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

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

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

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

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

    if -6.8000000000000005e-36 < x < -2.45000000000000002e-147

    1. Initial program 84.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. Taylor expanded in y around 0 41.1%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{x} - y} \]
    7. Simplified56.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+62}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -3.05 \cdot 10^{+53}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-21}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-36} \lor \neg \left(x \leq -2.45 \cdot 10^{-147}\right):\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x} - y\\ \end{array} \]

Alternative 10: 75.3% accurate, 1.0× speedup?

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

\mathbf{elif}\;x \leq -3.3 \cdot 10^{+53}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq -1:\\
\;\;\;\;t_0\\

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -9e61 or -3.3000000000000002e53 < x < -1

    1. Initial program 64.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac82.9%

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

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

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

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

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

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

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

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

    if -9e61 < x < -3.3000000000000002e53 or 2.2e-182 < x

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity34.6%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot y} \]
      2. times-frac38.9%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
      3. inv-pow38.9%

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

      \[\leadsto \color{blue}{{y}^{-1} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. unpow-138.9%

        \[\leadsto \color{blue}{\frac{1}{y}} \cdot \frac{x}{y} \]
    10. Simplified38.9%

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

    if -1 < x < -2.0500000000000001e-156

    1. Initial program 86.5%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{x} - y} \]
    7. Simplified53.0%

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

    if -2.0500000000000001e-156 < x < 2.2e-182

    1. Initial program 58.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac72.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9 \cdot 10^{+61}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -3.3 \cdot 10^{+53}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -1:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -2.05 \cdot 10^{-156}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{-182}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \end{array} \]

Alternative 11: 86.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

    if -1.6000000000000001e162 < x < -5.5000000000000003e-8

    1. Initial program 69.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac92.7%

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

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

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

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

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

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

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

    if -5.5000000000000003e-8 < x < 1.82e-211

    1. Initial program 63.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.82e-211 < x

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{+162}:\\ \;\;\;\;\frac{\frac{y}{y + \left(x + 1\right)}}{x + y}\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-8}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\ \mathbf{elif}\;x \leq 1.82 \cdot 10^{-211}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{y}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \]

Alternative 12: 86.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

    if -1.76e162 < x < -0.070000000000000007

    1. Initial program 69.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac92.7%

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

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

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

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

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

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

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

    if -0.070000000000000007 < x < 2.2499999999999999e-211

    1. Initial program 63.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.2499999999999999e-211 < x

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.76 \cdot 10^{+162}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -0.07:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-211}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{y}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \]

Alternative 13: 99.8% accurate, 1.0× speedup?

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

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Step-by-step derivation
    1. times-frac84.4%

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

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

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

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

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

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

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

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

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

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

Alternative 14: 79.5% accurate, 1.1× speedup?

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

\mathbf{elif}\;x \leq -2.1 \cdot 10^{+57}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\

\mathbf{elif}\;x \leq -1:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -3.79999999999999984e62 or -2.09999999999999991e57 < x < -1

    1. Initial program 64.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac82.9%

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

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

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

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

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

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

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

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

    if -3.79999999999999984e62 < x < -2.09999999999999991e57

    1. Initial program 7.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity7.9%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot y} \]
      2. times-frac100.0%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
      3. inv-pow100.0%

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

      \[\leadsto \color{blue}{{y}^{-1} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. unpow-1100.0%

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

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

    if -1 < x < -1.2599999999999999e-146

    1. Initial program 85.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. Taylor expanded in y around 0 40.9%

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

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

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

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

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

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

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

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

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

    if -1.2599999999999999e-146 < x

    1. Initial program 66.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac83.4%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{+62}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -2.1 \cdot 10^{+57}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -1:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \end{array} \]

Alternative 15: 81.7% accurate, 1.1× speedup?

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

\mathbf{elif}\;x \leq -2.4 \cdot 10^{+57}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\

\mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

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


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

    1. Initial program 61.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.19999999999999967e62 < x < -2.40000000000000005e57

    1. Initial program 7.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity7.9%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot y} \]
      2. times-frac100.0%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
      3. inv-pow100.0%

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

      \[\leadsto \color{blue}{{y}^{-1} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. unpow-1100.0%

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

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

    if -2.40000000000000005e57 < x < -1.2599999999999999e-146

    1. Initial program 84.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y + x} \cdot \left(\color{blue}{\frac{1}{\frac{y + \left(1 + x\right)}{y}}} \cdot \frac{1}{y + x}\right) \]
      3. frac-times99.7%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{1 \cdot 1}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      4. metadata-eval99.7%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\color{blue}{1}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)} \]
      5. div-inv99.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      6. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    6. Taylor expanded in y around 0 58.1%

      \[\leadsto \color{blue}{\frac{y}{\left(1 + x\right) \cdot x}} \]
    7. Step-by-step derivation
      1. *-commutative58.1%

        \[\leadsto \frac{y}{\color{blue}{x \cdot \left(1 + x\right)}} \]
      2. distribute-lft-in58.1%

        \[\leadsto \frac{y}{\color{blue}{x \cdot 1 + x \cdot x}} \]
      3. *-rgt-identity58.1%

        \[\leadsto \frac{y}{\color{blue}{x} + x \cdot x} \]
    8. Simplified58.1%

      \[\leadsto \color{blue}{\frac{y}{x + x \cdot x}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity58.1%

        \[\leadsto \frac{\color{blue}{1 \cdot y}}{x + x \cdot x} \]
      2. distribute-rgt1-in58.1%

        \[\leadsto \frac{1 \cdot y}{\color{blue}{\left(x + 1\right) \cdot x}} \]
      3. times-frac58.2%

        \[\leadsto \color{blue}{\frac{1}{x + 1} \cdot \frac{y}{x}} \]
    10. Applied egg-rr58.2%

      \[\leadsto \color{blue}{\frac{1}{x + 1} \cdot \frac{y}{x}} \]
    11. Step-by-step derivation
      1. associate-*l/58.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x}}{x + 1}} \]
      2. *-lft-identity58.1%

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x + 1} \]
    12. Simplified58.1%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]

    if -1.2599999999999999e-146 < x

    1. Initial program 66.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/77.4%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative77.4%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in66.6%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def77.3%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult77.4%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified77.4%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/66.6%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-udef57.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult57.2%

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in66.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+66.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative66.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times83.4%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
      8. *-commutative83.4%

        \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. clear-num83.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + \left(y + 1\right)}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \]
      10. associate-/r*99.7%

        \[\leadsto \frac{1}{\frac{x + \left(y + 1\right)}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      11. frac-times99.4%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)}} \]
      12. *-un-lft-identity99.4%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
      13. +-commutative99.4%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + x}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
      14. +-commutative99.4%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{\left(y + 1\right) + x}}{y} \cdot \left(x + y\right)} \]
      15. associate-+l+99.4%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{y + \left(1 + x\right)}}{y} \cdot \left(x + y\right)} \]
      16. +-commutative99.4%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \color{blue}{\left(y + x\right)}} \]
    5. Applied egg-rr99.4%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
    6. Taylor expanded in x around 0 60.7%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
    7. Step-by-step derivation
      1. +-commutative60.7%

        \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + 1}} \]
    8. Simplified60.7%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + 1}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification66.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.2 \cdot 10^{+62}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{+57}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \]

Alternative 16: 81.6% accurate, 1.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{+63}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{+56}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.1e+63)
   (/ (/ y x) (+ x y))
   (if (<= x -1.3e+56)
     (* (/ 1.0 y) (/ x y))
     (if (<= x -1.26e-146)
       (/ (/ y (+ x 1.0)) (+ x y))
       (/ (/ x (+ x y)) (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.1e+63) {
		tmp = (y / x) / (x + y);
	} else if (x <= -1.3e+56) {
		tmp = (1.0 / y) * (x / y);
	} else if (x <= -1.26e-146) {
		tmp = (y / (x + 1.0)) / (x + y);
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.1d+63)) then
        tmp = (y / x) / (x + y)
    else if (x <= (-1.3d+56)) then
        tmp = (1.0d0 / y) * (x / y)
    else if (x <= (-1.26d-146)) then
        tmp = (y / (x + 1.0d0)) / (x + y)
    else
        tmp = (x / (x + y)) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.1e+63) {
		tmp = (y / x) / (x + y);
	} else if (x <= -1.3e+56) {
		tmp = (1.0 / y) * (x / y);
	} else if (x <= -1.26e-146) {
		tmp = (y / (x + 1.0)) / (x + y);
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.1e+63:
		tmp = (y / x) / (x + y)
	elif x <= -1.3e+56:
		tmp = (1.0 / y) * (x / y)
	elif x <= -1.26e-146:
		tmp = (y / (x + 1.0)) / (x + y)
	else:
		tmp = (x / (x + y)) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.1e+63)
		tmp = Float64(Float64(y / x) / Float64(x + y));
	elseif (x <= -1.3e+56)
		tmp = Float64(Float64(1.0 / y) * Float64(x / y));
	elseif (x <= -1.26e-146)
		tmp = Float64(Float64(y / Float64(x + 1.0)) / Float64(x + y));
	else
		tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.1e+63)
		tmp = (y / x) / (x + y);
	elseif (x <= -1.3e+56)
		tmp = (1.0 / y) * (x / y);
	elseif (x <= -1.26e-146)
		tmp = (y / (x + 1.0)) / (x + y);
	else
		tmp = (x / (x + y)) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.1e+63], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.3e+56], N[(N[(1.0 / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.26e-146], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+63}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\

\mathbf{elif}\;x \leq -1.3 \cdot 10^{+56}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\

\mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.0999999999999999e63

    1. Initial program 61.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac79.9%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. associate-+r+79.9%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/80.0%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      4. times-frac99.8%

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y}} \]
      5. +-commutative99.8%

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y} \]
      6. +-commutative99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{\color{blue}{\left(y + 1\right) + x}}}{x + y} \]
      7. associate-+l+99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}}}{x + y} \]
      8. +-commutative99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{\color{blue}{y + x}} \]
    3. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{y + x}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\left(\frac{y}{y + \left(1 + x\right)} \cdot \frac{1}{y + x}\right)} \]
      2. clear-num99.7%

        \[\leadsto \frac{x}{y + x} \cdot \left(\color{blue}{\frac{1}{\frac{y + \left(1 + x\right)}{y}}} \cdot \frac{1}{y + x}\right) \]
      3. frac-times97.4%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{1 \cdot 1}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      4. metadata-eval97.4%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\color{blue}{1}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)} \]
      5. div-inv97.4%

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      6. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    6. Taylor expanded in x around inf 84.2%

      \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{y + x} \]

    if -1.0999999999999999e63 < x < -1.30000000000000005e56

    1. Initial program 7.9%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/7.9%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative7.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in7.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def7.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult7.9%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified7.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 7.9%

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow27.9%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified7.9%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity7.9%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot y} \]
      2. times-frac100.0%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
      3. inv-pow100.0%

        \[\leadsto \color{blue}{{y}^{-1}} \cdot \frac{x}{y} \]
    8. Applied egg-rr100.0%

      \[\leadsto \color{blue}{{y}^{-1} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. unpow-1100.0%

        \[\leadsto \color{blue}{\frac{1}{y}} \cdot \frac{x}{y} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]

    if -1.30000000000000005e56 < x < -1.2599999999999999e-146

    1. Initial program 84.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac99.6%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. associate-+r+99.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/90.4%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      4. times-frac99.8%

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y}} \]
      5. +-commutative99.8%

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y} \]
      6. +-commutative99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{\color{blue}{\left(y + 1\right) + x}}}{x + y} \]
      7. associate-+l+99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}}}{x + y} \]
      8. +-commutative99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{\color{blue}{y + x}} \]
    3. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{y + x}} \]
    4. Step-by-step derivation
      1. div-inv99.6%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\left(\frac{y}{y + \left(1 + x\right)} \cdot \frac{1}{y + x}\right)} \]
      2. clear-num99.6%

        \[\leadsto \frac{x}{y + x} \cdot \left(\color{blue}{\frac{1}{\frac{y + \left(1 + x\right)}{y}}} \cdot \frac{1}{y + x}\right) \]
      3. frac-times99.7%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{1 \cdot 1}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      4. metadata-eval99.7%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\color{blue}{1}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)} \]
      5. div-inv99.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      6. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    6. Taylor expanded in y around 0 58.6%

      \[\leadsto \frac{\color{blue}{\frac{y}{1 + x}}}{y + x} \]
    7. Step-by-step derivation
      1. +-commutative58.6%

        \[\leadsto \frac{\frac{y}{\color{blue}{x + 1}}}{y + x} \]
    8. Simplified58.6%

      \[\leadsto \frac{\color{blue}{\frac{y}{x + 1}}}{y + x} \]

    if -1.2599999999999999e-146 < x

    1. Initial program 66.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/77.4%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative77.4%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in66.6%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def77.3%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult77.4%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified77.4%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/66.6%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-udef57.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult57.2%

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in66.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+66.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative66.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times83.4%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
      8. *-commutative83.4%

        \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. clear-num83.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + \left(y + 1\right)}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \]
      10. associate-/r*99.7%

        \[\leadsto \frac{1}{\frac{x + \left(y + 1\right)}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      11. frac-times99.4%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)}} \]
      12. *-un-lft-identity99.4%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
      13. +-commutative99.4%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + x}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
      14. +-commutative99.4%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{\left(y + 1\right) + x}}{y} \cdot \left(x + y\right)} \]
      15. associate-+l+99.4%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{y + \left(1 + x\right)}}{y} \cdot \left(x + y\right)} \]
      16. +-commutative99.4%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \color{blue}{\left(y + x\right)}} \]
    5. Applied egg-rr99.4%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
    6. Taylor expanded in x around 0 60.7%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
    7. Step-by-step derivation
      1. +-commutative60.7%

        \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + 1}} \]
    8. Simplified60.7%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + 1}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification66.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{+63}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{+56}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \]

Alternative 17: 81.5% accurate, 1.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{\frac{y}{x + \left(y + 1\right)}}{x}\\ \mathbf{if}\;x \leq -7.8 \cdot 10^{+62}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{+53}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (/ y (+ x (+ y 1.0))) x)))
   (if (<= x -7.8e+62)
     t_0
     (if (<= x -2.2e+53)
       (* (/ 1.0 y) (/ x y))
       (if (<= x -1.26e-146) t_0 (/ (/ x (+ x y)) (+ y 1.0)))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = (y / (x + (y + 1.0))) / x;
	double tmp;
	if (x <= -7.8e+62) {
		tmp = t_0;
	} else if (x <= -2.2e+53) {
		tmp = (1.0 / y) * (x / y);
	} else if (x <= -1.26e-146) {
		tmp = t_0;
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (y / (x + (y + 1.0d0))) / x
    if (x <= (-7.8d+62)) then
        tmp = t_0
    else if (x <= (-2.2d+53)) then
        tmp = (1.0d0 / y) * (x / y)
    else if (x <= (-1.26d-146)) then
        tmp = t_0
    else
        tmp = (x / (x + y)) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = (y / (x + (y + 1.0))) / x;
	double tmp;
	if (x <= -7.8e+62) {
		tmp = t_0;
	} else if (x <= -2.2e+53) {
		tmp = (1.0 / y) * (x / y);
	} else if (x <= -1.26e-146) {
		tmp = t_0;
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = (y / (x + (y + 1.0))) / x
	tmp = 0
	if x <= -7.8e+62:
		tmp = t_0
	elif x <= -2.2e+53:
		tmp = (1.0 / y) * (x / y)
	elif x <= -1.26e-146:
		tmp = t_0
	else:
		tmp = (x / (x + y)) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(Float64(y / Float64(x + Float64(y + 1.0))) / x)
	tmp = 0.0
	if (x <= -7.8e+62)
		tmp = t_0;
	elseif (x <= -2.2e+53)
		tmp = Float64(Float64(1.0 / y) * Float64(x / y));
	elseif (x <= -1.26e-146)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = (y / (x + (y + 1.0))) / x;
	tmp = 0.0;
	if (x <= -7.8e+62)
		tmp = t_0;
	elseif (x <= -2.2e+53)
		tmp = (1.0 / y) * (x / y);
	elseif (x <= -1.26e-146)
		tmp = t_0;
	else
		tmp = (x / (x + y)) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(y / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, -7.8e+62], t$95$0, If[LessEqual[x, -2.2e+53], N[(N[(1.0 / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.26e-146], t$95$0, N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{x + \left(y + 1\right)}}{x}\\
\mathbf{if}\;x \leq -7.8 \cdot 10^{+62}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -2.2 \cdot 10^{+53}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\

\mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -7.8e62 or -2.19999999999999999e53 < x < -1.2599999999999999e-146

    1. Initial program 69.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac86.7%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity86.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/86.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity86.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+86.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified86.7%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around inf 75.1%

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{x + \left(y + 1\right)} \]
    5. Step-by-step derivation
      1. associate-*l/75.2%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x + \left(y + 1\right)}}{x}} \]
      2. *-un-lft-identity75.2%

        \[\leadsto \frac{\color{blue}{\frac{y}{x + \left(y + 1\right)}}}{x} \]
    6. Applied egg-rr75.2%

      \[\leadsto \color{blue}{\frac{\frac{y}{x + \left(y + 1\right)}}{x}} \]

    if -7.8e62 < x < -2.19999999999999999e53

    1. Initial program 7.9%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/7.9%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative7.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in7.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def7.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult7.9%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified7.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 7.9%

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow27.9%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified7.9%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity7.9%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot y} \]
      2. times-frac100.0%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
      3. inv-pow100.0%

        \[\leadsto \color{blue}{{y}^{-1}} \cdot \frac{x}{y} \]
    8. Applied egg-rr100.0%

      \[\leadsto \color{blue}{{y}^{-1} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. unpow-1100.0%

        \[\leadsto \color{blue}{\frac{1}{y}} \cdot \frac{x}{y} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]

    if -1.2599999999999999e-146 < x

    1. Initial program 66.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/77.4%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative77.4%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in66.6%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def77.3%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult77.4%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified77.4%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/66.6%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-udef57.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult57.2%

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in66.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+66.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative66.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times83.4%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
      8. *-commutative83.4%

        \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. clear-num83.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + \left(y + 1\right)}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \]
      10. associate-/r*99.7%

        \[\leadsto \frac{1}{\frac{x + \left(y + 1\right)}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      11. frac-times99.4%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)}} \]
      12. *-un-lft-identity99.4%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
      13. +-commutative99.4%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + x}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
      14. +-commutative99.4%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{\left(y + 1\right) + x}}{y} \cdot \left(x + y\right)} \]
      15. associate-+l+99.4%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{y + \left(1 + x\right)}}{y} \cdot \left(x + y\right)} \]
      16. +-commutative99.4%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \color{blue}{\left(y + x\right)}} \]
    5. Applied egg-rr99.4%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
    6. Taylor expanded in x around 0 60.7%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
    7. Step-by-step derivation
      1. +-commutative60.7%

        \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + 1}} \]
    8. Simplified60.7%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + 1}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification66.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.8 \cdot 10^{+62}:\\ \;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x}\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{+53}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\ \;\;\;\;\frac{\frac{y}{x + \left(y + 1\right)}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \]

Alternative 18: 55.2% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x} - y\\ \mathbf{if}\;y \leq 3.2 \cdot 10^{-272}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 6.4 \cdot 10^{-207}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-168}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.75:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- (/ y x) y)))
   (if (<= y 3.2e-272)
     t_0
     (if (<= y 6.4e-207)
       (/ x y)
       (if (<= y 5.2e-168)
         t_0
         (if (<= y 0.75) (- (/ x y) x) (/ x (* y y))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = (y / x) - y;
	double tmp;
	if (y <= 3.2e-272) {
		tmp = t_0;
	} else if (y <= 6.4e-207) {
		tmp = x / y;
	} else if (y <= 5.2e-168) {
		tmp = t_0;
	} else if (y <= 0.75) {
		tmp = (x / y) - x;
	} else {
		tmp = x / (y * y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (y / x) - y
    if (y <= 3.2d-272) then
        tmp = t_0
    else if (y <= 6.4d-207) then
        tmp = x / y
    else if (y <= 5.2d-168) then
        tmp = t_0
    else if (y <= 0.75d0) then
        tmp = (x / y) - x
    else
        tmp = x / (y * y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = (y / x) - y;
	double tmp;
	if (y <= 3.2e-272) {
		tmp = t_0;
	} else if (y <= 6.4e-207) {
		tmp = x / y;
	} else if (y <= 5.2e-168) {
		tmp = t_0;
	} else if (y <= 0.75) {
		tmp = (x / y) - x;
	} else {
		tmp = x / (y * y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = (y / x) - y
	tmp = 0
	if y <= 3.2e-272:
		tmp = t_0
	elif y <= 6.4e-207:
		tmp = x / y
	elif y <= 5.2e-168:
		tmp = t_0
	elif y <= 0.75:
		tmp = (x / y) - x
	else:
		tmp = x / (y * y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(Float64(y / x) - y)
	tmp = 0.0
	if (y <= 3.2e-272)
		tmp = t_0;
	elseif (y <= 6.4e-207)
		tmp = Float64(x / y);
	elseif (y <= 5.2e-168)
		tmp = t_0;
	elseif (y <= 0.75)
		tmp = Float64(Float64(x / y) - x);
	else
		tmp = Float64(x / Float64(y * y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = (y / x) - y;
	tmp = 0.0;
	if (y <= 3.2e-272)
		tmp = t_0;
	elseif (y <= 6.4e-207)
		tmp = x / y;
	elseif (y <= 5.2e-168)
		tmp = t_0;
	elseif (y <= 0.75)
		tmp = (x / y) - x;
	else
		tmp = x / (y * y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[y, 3.2e-272], t$95$0, If[LessEqual[y, 6.4e-207], N[(x / y), $MachinePrecision], If[LessEqual[y, 5.2e-168], t$95$0, If[LessEqual[y, 0.75], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x} - y\\
\mathbf{if}\;y \leq 3.2 \cdot 10^{-272}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 6.4 \cdot 10^{-207}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;y \leq 5.2 \cdot 10^{-168}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 0.75:\\
\;\;\;\;\frac{x}{y} - x\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 3.2e-272 or 6.4000000000000006e-207 < y < 5.2000000000000002e-168

    1. Initial program 69.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. Taylor expanded in y around 0 41.6%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(1 + x\right) \cdot {x}^{2}}} \]
    3. Step-by-step derivation
      1. *-commutative41.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{{x}^{2} \cdot \left(1 + x\right)}} \]
      2. unpow241.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x \cdot x\right)} \cdot \left(1 + x\right)} \]
      3. +-commutative41.6%

        \[\leadsto \frac{x \cdot y}{\left(x \cdot x\right) \cdot \color{blue}{\left(x + 1\right)}} \]
    4. Simplified41.6%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x \cdot x\right) \cdot \left(x + 1\right)}} \]
    5. Taylor expanded in x around 0 18.2%

      \[\leadsto \color{blue}{\frac{y}{x} + -1 \cdot y} \]
    6. Step-by-step derivation
      1. neg-mul-118.2%

        \[\leadsto \frac{y}{x} + \color{blue}{\left(-y\right)} \]
      2. unsub-neg18.2%

        \[\leadsto \color{blue}{\frac{y}{x} - y} \]
    7. Simplified18.2%

      \[\leadsto \color{blue}{\frac{y}{x} - y} \]

    if 3.2e-272 < y < 6.4000000000000006e-207

    1. Initial program 40.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac60.7%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity60.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/60.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity60.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+60.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified60.7%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around 0 18.5%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. distribute-rgt-in18.5%

        \[\leadsto \frac{x}{\color{blue}{1 \cdot y + y \cdot y}} \]
      2. *-lft-identity18.5%

        \[\leadsto \frac{x}{\color{blue}{y} + y \cdot y} \]
    6. Simplified18.5%

      \[\leadsto \color{blue}{\frac{x}{y + y \cdot y}} \]
    7. Taylor expanded in y around 0 18.5%

      \[\leadsto \frac{x}{\color{blue}{y}} \]

    if 5.2000000000000002e-168 < y < 0.75

    1. Initial program 85.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac96.8%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity96.8%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/96.8%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity96.8%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+96.8%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified96.8%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around 0 37.3%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. distribute-rgt-in37.3%

        \[\leadsto \frac{x}{\color{blue}{1 \cdot y + y \cdot y}} \]
      2. *-lft-identity37.3%

        \[\leadsto \frac{x}{\color{blue}{y} + y \cdot y} \]
    6. Simplified37.3%

      \[\leadsto \color{blue}{\frac{x}{y + y \cdot y}} \]
    7. Taylor expanded in y around 0 37.3%

      \[\leadsto \color{blue}{\frac{x}{y} + -1 \cdot x} \]
    8. Step-by-step derivation
      1. neg-mul-137.3%

        \[\leadsto \frac{x}{y} + \color{blue}{\left(-x\right)} \]
      2. unsub-neg37.3%

        \[\leadsto \color{blue}{\frac{x}{y} - x} \]
    9. Simplified37.3%

      \[\leadsto \color{blue}{\frac{x}{y} - x} \]

    if 0.75 < y

    1. Initial program 56.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/69.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. *-commutative69.8%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in63.2%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def69.8%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult69.8%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified69.8%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 62.2%

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow262.2%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified62.2%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification31.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.2 \cdot 10^{-272}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;y \leq 6.4 \cdot 10^{-207}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-168}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;y \leq 0.75:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]

Alternative 19: 72.4% 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 x}\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-157}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-179}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{y \cdot y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.0)
   (/ y (* x x))
   (if (<= x -5.5e-157)
     (- (/ y x) y)
     (if (<= x 1.35e-179) (/ x y) (* x (/ 1.0 (* y y)))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.0) {
		tmp = y / (x * x);
	} else if (x <= -5.5e-157) {
		tmp = (y / x) - y;
	} else if (x <= 1.35e-179) {
		tmp = x / y;
	} else {
		tmp = x * (1.0 / (y * y));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.0d0)) then
        tmp = y / (x * x)
    else if (x <= (-5.5d-157)) then
        tmp = (y / x) - y
    else if (x <= 1.35d-179) then
        tmp = x / y
    else
        tmp = x * (1.0d0 / (y * 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 * x);
	} else if (x <= -5.5e-157) {
		tmp = (y / x) - y;
	} else if (x <= 1.35e-179) {
		tmp = x / y;
	} else {
		tmp = x * (1.0 / (y * y));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.0:
		tmp = y / (x * x)
	elif x <= -5.5e-157:
		tmp = (y / x) - y
	elif x <= 1.35e-179:
		tmp = x / y
	else:
		tmp = x * (1.0 / (y * y))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.0)
		tmp = Float64(y / Float64(x * x));
	elseif (x <= -5.5e-157)
		tmp = Float64(Float64(y / x) - y);
	elseif (x <= 1.35e-179)
		tmp = Float64(x / y);
	else
		tmp = Float64(x * Float64(1.0 / Float64(y * 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 * x);
	elseif (x <= -5.5e-157)
		tmp = (y / x) - y;
	elseif (x <= 1.35e-179)
		tmp = x / y;
	else
		tmp = x * (1.0 / (y * y));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.5e-157], N[(N[(y / x), $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 1.35e-179], N[(x / y), $MachinePrecision], N[(x * N[(1.0 / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{y}{x \cdot x}\\

\mathbf{elif}\;x \leq -5.5 \cdot 10^{-157}:\\
\;\;\;\;\frac{y}{x} - y\\

\mathbf{elif}\;x \leq 1.35 \cdot 10^{-179}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{y \cdot y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1

    1. Initial program 63.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/72.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. *-commutative72.5%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in32.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def72.5%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult72.5%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified72.5%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in x around inf 71.1%

      \[\leadsto \color{blue}{\frac{y}{{x}^{2}}} \]
    5. Step-by-step derivation
      1. unpow271.1%

        \[\leadsto \frac{y}{\color{blue}{x \cdot x}} \]
    6. Simplified71.1%

      \[\leadsto \color{blue}{\frac{y}{x \cdot x}} \]

    if -1 < x < -5.4999999999999998e-157

    1. Initial program 87.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Taylor expanded in y around 0 37.9%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(1 + x\right) \cdot {x}^{2}}} \]
    3. Step-by-step derivation
      1. *-commutative37.9%

        \[\leadsto \frac{x \cdot y}{\color{blue}{{x}^{2} \cdot \left(1 + x\right)}} \]
      2. unpow237.9%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x \cdot x\right)} \cdot \left(1 + x\right)} \]
      3. +-commutative37.9%

        \[\leadsto \frac{x \cdot y}{\left(x \cdot x\right) \cdot \color{blue}{\left(x + 1\right)}} \]
    4. Simplified37.9%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x \cdot x\right) \cdot \left(x + 1\right)}} \]
    5. Taylor expanded in x around 0 50.8%

      \[\leadsto \color{blue}{\frac{y}{x} + -1 \cdot y} \]
    6. Step-by-step derivation
      1. neg-mul-150.8%

        \[\leadsto \frac{y}{x} + \color{blue}{\left(-y\right)} \]
      2. unsub-neg50.8%

        \[\leadsto \color{blue}{\frac{y}{x} - y} \]
    7. Simplified50.8%

      \[\leadsto \color{blue}{\frac{y}{x} - y} \]

    if -5.4999999999999998e-157 < x < 1.34999999999999994e-179

    1. Initial program 58.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac71.6%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity71.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/71.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity71.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+71.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified71.6%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around 0 83.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. distribute-rgt-in83.7%

        \[\leadsto \frac{x}{\color{blue}{1 \cdot y + y \cdot y}} \]
      2. *-lft-identity83.7%

        \[\leadsto \frac{x}{\color{blue}{y} + y \cdot y} \]
    6. Simplified83.7%

      \[\leadsto \color{blue}{\frac{x}{y + y \cdot y}} \]
    7. Taylor expanded in y around 0 77.9%

      \[\leadsto \frac{x}{\color{blue}{y}} \]

    if 1.34999999999999994e-179 < x

    1. Initial program 72.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/81.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. *-commutative81.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in72.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def80.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult80.9%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified80.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 34.9%

      \[\leadsto x \cdot \color{blue}{\frac{1}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow234.9%

        \[\leadsto x \cdot \frac{1}{\color{blue}{y \cdot y}} \]
    6. Simplified34.9%

      \[\leadsto x \cdot \color{blue}{\frac{1}{y \cdot y}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification58.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-157}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-179}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{y \cdot y}\\ \end{array} \]

Alternative 20: 74.4% 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 -1.9 \cdot 10^{-156}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq 1.12 \cdot 10^{-182}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{y \cdot y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.0)
   (* (/ y x) (/ 1.0 x))
   (if (<= x -1.9e-156)
     (- (/ y x) y)
     (if (<= x 1.12e-182) (/ x y) (* x (/ 1.0 (* y 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 <= -1.9e-156) {
		tmp = (y / x) - y;
	} else if (x <= 1.12e-182) {
		tmp = x / y;
	} else {
		tmp = x * (1.0 / (y * y));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.0d0)) then
        tmp = (y / x) * (1.0d0 / x)
    else if (x <= (-1.9d-156)) then
        tmp = (y / x) - y
    else if (x <= 1.12d-182) then
        tmp = x / y
    else
        tmp = x * (1.0d0 / (y * 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 <= -1.9e-156) {
		tmp = (y / x) - y;
	} else if (x <= 1.12e-182) {
		tmp = x / y;
	} else {
		tmp = x * (1.0 / (y * 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 <= -1.9e-156:
		tmp = (y / x) - y
	elif x <= 1.12e-182:
		tmp = x / y
	else:
		tmp = x * (1.0 / (y * 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 <= -1.9e-156)
		tmp = Float64(Float64(y / x) - y);
	elseif (x <= 1.12e-182)
		tmp = Float64(x / y);
	else
		tmp = Float64(x * Float64(1.0 / Float64(y * 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 <= -1.9e-156)
		tmp = (y / x) - y;
	elseif (x <= 1.12e-182)
		tmp = x / y;
	else
		tmp = x * (1.0 / (y * y));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.9e-156], N[(N[(y / x), $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 1.12e-182], N[(x / y), $MachinePrecision], N[(x * N[(1.0 / N[(y * y), $MachinePrecision]), $MachinePrecision]), $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 -1.9 \cdot 10^{-156}:\\
\;\;\;\;\frac{y}{x} - y\\

\mathbf{elif}\;x \leq 1.12 \cdot 10^{-182}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{y \cdot y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1

    1. Initial program 63.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac81.8%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity81.8%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/81.8%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity81.8%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+81.8%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified81.8%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around inf 80.2%

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{x + \left(y + 1\right)} \]
    5. Taylor expanded in x around inf 78.8%

      \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{y}{x}} \]

    if -1 < x < -1.90000000000000004e-156

    1. Initial program 87.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Taylor expanded in y around 0 37.9%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(1 + x\right) \cdot {x}^{2}}} \]
    3. Step-by-step derivation
      1. *-commutative37.9%

        \[\leadsto \frac{x \cdot y}{\color{blue}{{x}^{2} \cdot \left(1 + x\right)}} \]
      2. unpow237.9%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x \cdot x\right)} \cdot \left(1 + x\right)} \]
      3. +-commutative37.9%

        \[\leadsto \frac{x \cdot y}{\left(x \cdot x\right) \cdot \color{blue}{\left(x + 1\right)}} \]
    4. Simplified37.9%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x \cdot x\right) \cdot \left(x + 1\right)}} \]
    5. Taylor expanded in x around 0 50.8%

      \[\leadsto \color{blue}{\frac{y}{x} + -1 \cdot y} \]
    6. Step-by-step derivation
      1. neg-mul-150.8%

        \[\leadsto \frac{y}{x} + \color{blue}{\left(-y\right)} \]
      2. unsub-neg50.8%

        \[\leadsto \color{blue}{\frac{y}{x} - y} \]
    7. Simplified50.8%

      \[\leadsto \color{blue}{\frac{y}{x} - y} \]

    if -1.90000000000000004e-156 < x < 1.11999999999999994e-182

    1. Initial program 58.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac71.6%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity71.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/71.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity71.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+71.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified71.6%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around 0 83.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. distribute-rgt-in83.7%

        \[\leadsto \frac{x}{\color{blue}{1 \cdot y + y \cdot y}} \]
      2. *-lft-identity83.7%

        \[\leadsto \frac{x}{\color{blue}{y} + y \cdot y} \]
    6. Simplified83.7%

      \[\leadsto \color{blue}{\frac{x}{y + y \cdot y}} \]
    7. Taylor expanded in y around 0 77.9%

      \[\leadsto \frac{x}{\color{blue}{y}} \]

    if 1.11999999999999994e-182 < x

    1. Initial program 72.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/81.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. *-commutative81.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in72.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def80.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult80.9%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified80.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 34.9%

      \[\leadsto x \cdot \color{blue}{\frac{1}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow234.9%

        \[\leadsto x \cdot \frac{1}{\color{blue}{y \cdot y}} \]
    6. Simplified34.9%

      \[\leadsto x \cdot \color{blue}{\frac{1}{y \cdot y}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification60.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-156}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq 1.12 \cdot 10^{-182}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{y \cdot y}\\ \end{array} \]

Alternative 21: 80.1% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{\frac{y}{x}}{x + 1}\\ \mathbf{if}\;x \leq -8.6 \cdot 10^{+61}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{+56}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (/ y x) (+ x 1.0))))
   (if (<= x -8.6e+61)
     t_0
     (if (<= x -1.3e+56)
       (* (/ 1.0 y) (/ x y))
       (if (<= x -1.26e-146) t_0 (/ x (+ y (* y y))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = (y / x) / (x + 1.0);
	double tmp;
	if (x <= -8.6e+61) {
		tmp = t_0;
	} else if (x <= -1.3e+56) {
		tmp = (1.0 / y) * (x / y);
	} else if (x <= -1.26e-146) {
		tmp = t_0;
	} else {
		tmp = x / (y + (y * y));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (y / x) / (x + 1.0d0)
    if (x <= (-8.6d+61)) then
        tmp = t_0
    else if (x <= (-1.3d+56)) then
        tmp = (1.0d0 / y) * (x / y)
    else if (x <= (-1.26d-146)) then
        tmp = t_0
    else
        tmp = x / (y + (y * y))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = (y / x) / (x + 1.0);
	double tmp;
	if (x <= -8.6e+61) {
		tmp = t_0;
	} else if (x <= -1.3e+56) {
		tmp = (1.0 / y) * (x / y);
	} else if (x <= -1.26e-146) {
		tmp = t_0;
	} else {
		tmp = x / (y + (y * y));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = (y / x) / (x + 1.0)
	tmp = 0
	if x <= -8.6e+61:
		tmp = t_0
	elif x <= -1.3e+56:
		tmp = (1.0 / y) * (x / y)
	elif x <= -1.26e-146:
		tmp = t_0
	else:
		tmp = x / (y + (y * y))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(Float64(y / x) / Float64(x + 1.0))
	tmp = 0.0
	if (x <= -8.6e+61)
		tmp = t_0;
	elseif (x <= -1.3e+56)
		tmp = Float64(Float64(1.0 / y) * Float64(x / y));
	elseif (x <= -1.26e-146)
		tmp = t_0;
	else
		tmp = Float64(x / Float64(y + Float64(y * y)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = (y / x) / (x + 1.0);
	tmp = 0.0;
	if (x <= -8.6e+61)
		tmp = t_0;
	elseif (x <= -1.3e+56)
		tmp = (1.0 / y) * (x / y);
	elseif (x <= -1.26e-146)
		tmp = t_0;
	else
		tmp = x / (y + (y * y));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.6e+61], t$95$0, If[LessEqual[x, -1.3e+56], N[(N[(1.0 / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.26e-146], t$95$0, N[(x / N[(y + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{x}}{x + 1}\\
\mathbf{if}\;x \leq -8.6 \cdot 10^{+61}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -1.3 \cdot 10^{+56}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\

\mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y + y \cdot y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -8.6000000000000003e61 or -1.30000000000000005e56 < x < -1.2599999999999999e-146

    1. Initial program 69.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac86.7%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. associate-+r+86.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/83.6%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      4. times-frac99.8%

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y}} \]
      5. +-commutative99.8%

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y} \]
      6. +-commutative99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{\color{blue}{\left(y + 1\right) + x}}}{x + y} \]
      7. associate-+l+99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}}}{x + y} \]
      8. +-commutative99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{\color{blue}{y + x}} \]
    3. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{y + x}} \]
    4. Step-by-step derivation
      1. div-inv99.7%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\left(\frac{y}{y + \left(1 + x\right)} \cdot \frac{1}{y + x}\right)} \]
      2. clear-num99.7%

        \[\leadsto \frac{x}{y + x} \cdot \left(\color{blue}{\frac{1}{\frac{y + \left(1 + x\right)}{y}}} \cdot \frac{1}{y + x}\right) \]
      3. frac-times98.2%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{1 \cdot 1}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      4. metadata-eval98.2%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\color{blue}{1}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)} \]
      5. div-inv98.2%

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      6. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    6. Taylor expanded in y around 0 68.9%

      \[\leadsto \color{blue}{\frac{y}{\left(1 + x\right) \cdot x}} \]
    7. Step-by-step derivation
      1. *-commutative68.9%

        \[\leadsto \frac{y}{\color{blue}{x \cdot \left(1 + x\right)}} \]
      2. distribute-lft-in68.9%

        \[\leadsto \frac{y}{\color{blue}{x \cdot 1 + x \cdot x}} \]
      3. *-rgt-identity68.9%

        \[\leadsto \frac{y}{\color{blue}{x} + x \cdot x} \]
    8. Simplified68.9%

      \[\leadsto \color{blue}{\frac{y}{x + x \cdot x}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity68.9%

        \[\leadsto \frac{\color{blue}{1 \cdot y}}{x + x \cdot x} \]
      2. distribute-rgt1-in68.9%

        \[\leadsto \frac{1 \cdot y}{\color{blue}{\left(x + 1\right) \cdot x}} \]
      3. times-frac74.9%

        \[\leadsto \color{blue}{\frac{1}{x + 1} \cdot \frac{y}{x}} \]
    10. Applied egg-rr74.9%

      \[\leadsto \color{blue}{\frac{1}{x + 1} \cdot \frac{y}{x}} \]
    11. Step-by-step derivation
      1. associate-*l/74.9%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x}}{x + 1}} \]
      2. *-lft-identity74.9%

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x + 1} \]
    12. Simplified74.9%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]

    if -8.6000000000000003e61 < x < -1.30000000000000005e56

    1. Initial program 7.9%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/7.9%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative7.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in7.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def7.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult7.9%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified7.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 7.9%

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow27.9%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified7.9%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity7.9%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot y} \]
      2. times-frac100.0%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
      3. inv-pow100.0%

        \[\leadsto \color{blue}{{y}^{-1}} \cdot \frac{x}{y} \]
    8. Applied egg-rr100.0%

      \[\leadsto \color{blue}{{y}^{-1} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. unpow-1100.0%

        \[\leadsto \color{blue}{\frac{1}{y}} \cdot \frac{x}{y} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]

    if -1.2599999999999999e-146 < x

    1. Initial program 66.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac83.4%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity83.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/83.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity83.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+83.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified83.4%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around 0 58.4%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. distribute-rgt-in58.4%

        \[\leadsto \frac{x}{\color{blue}{1 \cdot y + y \cdot y}} \]
      2. *-lft-identity58.4%

        \[\leadsto \frac{x}{\color{blue}{y} + y \cdot y} \]
    6. Simplified58.4%

      \[\leadsto \color{blue}{\frac{x}{y + y \cdot y}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification64.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.6 \cdot 10^{+61}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{+56}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \end{array} \]

Alternative 22: 80.1% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+62}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -5.4 \cdot 10^{+55}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -6.5e+62)
   (/ (/ y x) (+ x y))
   (if (<= x -5.4e+55)
     (* (/ 1.0 y) (/ x y))
     (if (<= x -1.26e-146) (/ (/ y x) (+ x 1.0)) (/ x (+ y (* y y)))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -6.5e+62) {
		tmp = (y / x) / (x + y);
	} else if (x <= -5.4e+55) {
		tmp = (1.0 / y) * (x / y);
	} else if (x <= -1.26e-146) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = x / (y + (y * y));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-6.5d+62)) then
        tmp = (y / x) / (x + y)
    else if (x <= (-5.4d+55)) then
        tmp = (1.0d0 / y) * (x / y)
    else if (x <= (-1.26d-146)) then
        tmp = (y / x) / (x + 1.0d0)
    else
        tmp = x / (y + (y * y))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -6.5e+62) {
		tmp = (y / x) / (x + y);
	} else if (x <= -5.4e+55) {
		tmp = (1.0 / y) * (x / y);
	} else if (x <= -1.26e-146) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = x / (y + (y * y));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -6.5e+62:
		tmp = (y / x) / (x + y)
	elif x <= -5.4e+55:
		tmp = (1.0 / y) * (x / y)
	elif x <= -1.26e-146:
		tmp = (y / x) / (x + 1.0)
	else:
		tmp = x / (y + (y * y))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -6.5e+62)
		tmp = Float64(Float64(y / x) / Float64(x + y));
	elseif (x <= -5.4e+55)
		tmp = Float64(Float64(1.0 / y) * Float64(x / y));
	elseif (x <= -1.26e-146)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	else
		tmp = Float64(x / Float64(y + Float64(y * y)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -6.5e+62)
		tmp = (y / x) / (x + y);
	elseif (x <= -5.4e+55)
		tmp = (1.0 / y) * (x / y);
	elseif (x <= -1.26e-146)
		tmp = (y / x) / (x + 1.0);
	else
		tmp = x / (y + (y * y));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -6.5e+62], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.4e+55], N[(N[(1.0 / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.26e-146], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(y + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+62}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\

\mathbf{elif}\;x \leq -5.4 \cdot 10^{+55}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\

\mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y + y \cdot y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -6.5000000000000003e62

    1. Initial program 61.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac79.9%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. associate-+r+79.9%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/80.0%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      4. times-frac99.8%

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y}} \]
      5. +-commutative99.8%

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y} \]
      6. +-commutative99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{\color{blue}{\left(y + 1\right) + x}}}{x + y} \]
      7. associate-+l+99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}}}{x + y} \]
      8. +-commutative99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{\color{blue}{y + x}} \]
    3. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{y + x}} \]
    4. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\left(\frac{y}{y + \left(1 + x\right)} \cdot \frac{1}{y + x}\right)} \]
      2. clear-num99.7%

        \[\leadsto \frac{x}{y + x} \cdot \left(\color{blue}{\frac{1}{\frac{y + \left(1 + x\right)}{y}}} \cdot \frac{1}{y + x}\right) \]
      3. frac-times97.4%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{1 \cdot 1}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      4. metadata-eval97.4%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\color{blue}{1}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)} \]
      5. div-inv97.4%

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      6. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    6. Taylor expanded in x around inf 84.2%

      \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{y + x} \]

    if -6.5000000000000003e62 < x < -5.39999999999999954e55

    1. Initial program 7.9%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/7.9%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative7.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in7.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def7.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult7.9%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified7.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 7.9%

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow27.9%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified7.9%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity7.9%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot y} \]
      2. times-frac100.0%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
      3. inv-pow100.0%

        \[\leadsto \color{blue}{{y}^{-1}} \cdot \frac{x}{y} \]
    8. Applied egg-rr100.0%

      \[\leadsto \color{blue}{{y}^{-1} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. unpow-1100.0%

        \[\leadsto \color{blue}{\frac{1}{y}} \cdot \frac{x}{y} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]

    if -5.39999999999999954e55 < x < -1.2599999999999999e-146

    1. Initial program 84.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac99.6%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. associate-+r+99.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/90.4%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      4. times-frac99.8%

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y}} \]
      5. +-commutative99.8%

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y} \]
      6. +-commutative99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{\color{blue}{\left(y + 1\right) + x}}}{x + y} \]
      7. associate-+l+99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}}}{x + y} \]
      8. +-commutative99.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{\color{blue}{y + x}} \]
    3. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{y + x}} \]
    4. Step-by-step derivation
      1. div-inv99.6%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\left(\frac{y}{y + \left(1 + x\right)} \cdot \frac{1}{y + x}\right)} \]
      2. clear-num99.6%

        \[\leadsto \frac{x}{y + x} \cdot \left(\color{blue}{\frac{1}{\frac{y + \left(1 + x\right)}{y}}} \cdot \frac{1}{y + x}\right) \]
      3. frac-times99.7%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{1 \cdot 1}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      4. metadata-eval99.7%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\color{blue}{1}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)} \]
      5. div-inv99.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      6. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    6. Taylor expanded in y around 0 58.1%

      \[\leadsto \color{blue}{\frac{y}{\left(1 + x\right) \cdot x}} \]
    7. Step-by-step derivation
      1. *-commutative58.1%

        \[\leadsto \frac{y}{\color{blue}{x \cdot \left(1 + x\right)}} \]
      2. distribute-lft-in58.1%

        \[\leadsto \frac{y}{\color{blue}{x \cdot 1 + x \cdot x}} \]
      3. *-rgt-identity58.1%

        \[\leadsto \frac{y}{\color{blue}{x} + x \cdot x} \]
    8. Simplified58.1%

      \[\leadsto \color{blue}{\frac{y}{x + x \cdot x}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity58.1%

        \[\leadsto \frac{\color{blue}{1 \cdot y}}{x + x \cdot x} \]
      2. distribute-rgt1-in58.1%

        \[\leadsto \frac{1 \cdot y}{\color{blue}{\left(x + 1\right) \cdot x}} \]
      3. times-frac58.2%

        \[\leadsto \color{blue}{\frac{1}{x + 1} \cdot \frac{y}{x}} \]
    10. Applied egg-rr58.2%

      \[\leadsto \color{blue}{\frac{1}{x + 1} \cdot \frac{y}{x}} \]
    11. Step-by-step derivation
      1. associate-*l/58.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x}}{x + 1}} \]
      2. *-lft-identity58.1%

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x + 1} \]
    12. Simplified58.1%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]

    if -1.2599999999999999e-146 < x

    1. Initial program 66.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac83.4%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity83.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/83.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity83.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+83.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified83.4%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around 0 58.4%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. distribute-rgt-in58.4%

        \[\leadsto \frac{x}{\color{blue}{1 \cdot y + y \cdot y}} \]
      2. *-lft-identity58.4%

        \[\leadsto \frac{x}{\color{blue}{y} + y \cdot y} \]
    6. Simplified58.4%

      \[\leadsto \color{blue}{\frac{x}{y + y \cdot y}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification64.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{+62}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -5.4 \cdot 10^{+55}:\\ \;\;\;\;\frac{1}{y} \cdot \frac{x}{y}\\ \mathbf{elif}\;x \leq -1.26 \cdot 10^{-146}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \end{array} \]

Alternative 23: 72.4% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-157}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-180}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.0)
   (/ y (* x x))
   (if (<= x -1.7e-157)
     (- (/ y x) y)
     (if (<= x 3e-180) (/ x y) (/ x (* y y))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.0) {
		tmp = y / (x * x);
	} else if (x <= -1.7e-157) {
		tmp = (y / x) - y;
	} else if (x <= 3e-180) {
		tmp = x / y;
	} else {
		tmp = x / (y * y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.0d0)) then
        tmp = y / (x * x)
    else if (x <= (-1.7d-157)) then
        tmp = (y / x) - y
    else if (x <= 3d-180) then
        tmp = x / y
    else
        tmp = x / (y * y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.0) {
		tmp = y / (x * x);
	} else if (x <= -1.7e-157) {
		tmp = (y / x) - y;
	} else if (x <= 3e-180) {
		tmp = x / y;
	} else {
		tmp = x / (y * y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.0:
		tmp = y / (x * x)
	elif x <= -1.7e-157:
		tmp = (y / x) - y
	elif x <= 3e-180:
		tmp = x / y
	else:
		tmp = x / (y * y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.0)
		tmp = Float64(y / Float64(x * x));
	elseif (x <= -1.7e-157)
		tmp = Float64(Float64(y / x) - y);
	elseif (x <= 3e-180)
		tmp = Float64(x / y);
	else
		tmp = Float64(x / Float64(y * y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.0)
		tmp = y / (x * x);
	elseif (x <= -1.7e-157)
		tmp = (y / x) - y;
	elseif (x <= 3e-180)
		tmp = x / y;
	else
		tmp = x / (y * y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.7e-157], N[(N[(y / x), $MachinePrecision] - y), $MachinePrecision], If[LessEqual[x, 3e-180], N[(x / y), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{y}{x \cdot x}\\

\mathbf{elif}\;x \leq -1.7 \cdot 10^{-157}:\\
\;\;\;\;\frac{y}{x} - y\\

\mathbf{elif}\;x \leq 3 \cdot 10^{-180}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1

    1. Initial program 63.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/72.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. *-commutative72.5%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in32.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def72.5%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult72.5%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified72.5%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in x around inf 71.1%

      \[\leadsto \color{blue}{\frac{y}{{x}^{2}}} \]
    5. Step-by-step derivation
      1. unpow271.1%

        \[\leadsto \frac{y}{\color{blue}{x \cdot x}} \]
    6. Simplified71.1%

      \[\leadsto \color{blue}{\frac{y}{x \cdot x}} \]

    if -1 < x < -1.69999999999999989e-157

    1. Initial program 87.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Taylor expanded in y around 0 37.9%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(1 + x\right) \cdot {x}^{2}}} \]
    3. Step-by-step derivation
      1. *-commutative37.9%

        \[\leadsto \frac{x \cdot y}{\color{blue}{{x}^{2} \cdot \left(1 + x\right)}} \]
      2. unpow237.9%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x \cdot x\right)} \cdot \left(1 + x\right)} \]
      3. +-commutative37.9%

        \[\leadsto \frac{x \cdot y}{\left(x \cdot x\right) \cdot \color{blue}{\left(x + 1\right)}} \]
    4. Simplified37.9%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x \cdot x\right) \cdot \left(x + 1\right)}} \]
    5. Taylor expanded in x around 0 50.8%

      \[\leadsto \color{blue}{\frac{y}{x} + -1 \cdot y} \]
    6. Step-by-step derivation
      1. neg-mul-150.8%

        \[\leadsto \frac{y}{x} + \color{blue}{\left(-y\right)} \]
      2. unsub-neg50.8%

        \[\leadsto \color{blue}{\frac{y}{x} - y} \]
    7. Simplified50.8%

      \[\leadsto \color{blue}{\frac{y}{x} - y} \]

    if -1.69999999999999989e-157 < x < 3.0000000000000001e-180

    1. Initial program 58.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac71.6%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity71.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/71.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity71.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+71.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified71.6%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around 0 83.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. distribute-rgt-in83.7%

        \[\leadsto \frac{x}{\color{blue}{1 \cdot y + y \cdot y}} \]
      2. *-lft-identity83.7%

        \[\leadsto \frac{x}{\color{blue}{y} + y \cdot y} \]
    6. Simplified83.7%

      \[\leadsto \color{blue}{\frac{x}{y + y \cdot y}} \]
    7. Taylor expanded in y around 0 77.9%

      \[\leadsto \frac{x}{\color{blue}{y}} \]

    if 3.0000000000000001e-180 < x

    1. Initial program 72.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/81.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. *-commutative81.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in72.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def80.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult80.9%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified80.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 34.9%

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow234.9%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified34.9%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification58.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-157}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq 3 \cdot 10^{-180}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]

Alternative 24: 80.3% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -580:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;y \leq 47000000:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\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 -580.0)
   (* (/ y x) (/ 1.0 x))
   (if (<= y 47000000.0) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ x y)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= -580.0) {
		tmp = (y / x) * (1.0 / x);
	} else if (y <= 47000000.0) {
		tmp = y / (x * (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 <= (-580.0d0)) then
        tmp = (y / x) * (1.0d0 / x)
    else if (y <= 47000000.0d0) then
        tmp = y / (x * (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 <= -580.0) {
		tmp = (y / x) * (1.0 / x);
	} else if (y <= 47000000.0) {
		tmp = y / (x * (x + 1.0));
	} else {
		tmp = (x / y) / (x + y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= -580.0:
		tmp = (y / x) * (1.0 / x)
	elif y <= 47000000.0:
		tmp = y / (x * (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 <= -580.0)
		tmp = Float64(Float64(y / x) * Float64(1.0 / x));
	elseif (y <= 47000000.0)
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	else
		tmp = Float64(Float64(x / y) / Float64(x + y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -580.0)
		tmp = (y / x) * (1.0 / x);
	elseif (y <= 47000000.0)
		tmp = y / (x * (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, -580.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 47000000.0], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -580:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\

\mathbf{elif}\;y \leq 47000000:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{x + y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -580

    1. Initial program 65.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac84.4%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity84.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/84.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity84.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+84.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified84.4%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around inf 30.9%

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{x + \left(y + 1\right)} \]
    5. Taylor expanded in x around inf 29.9%

      \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{y}{x}} \]

    if -580 < y < 4.7e7

    1. Initial program 73.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac86.2%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity86.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/86.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity86.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+86.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified86.2%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in y around 0 72.7%

      \[\leadsto \color{blue}{\frac{y}{\left(1 + x\right) \cdot x}} \]

    if 4.7e7 < y

    1. Initial program 54.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac80.0%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. associate-+r+80.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
      3. associate-*l/80.1%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      4. times-frac99.7%

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y}} \]
      5. +-commutative99.7%

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{\frac{y}{x + \left(y + 1\right)}}{x + y} \]
      6. +-commutative99.7%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{\color{blue}{\left(y + 1\right) + x}}}{x + y} \]
      7. associate-+l+99.7%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}}}{x + y} \]
      8. +-commutative99.7%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{\color{blue}{y + x}} \]
    3. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{\frac{y}{y + \left(1 + x\right)}}{y + x}} \]
    4. Step-by-step derivation
      1. div-inv99.6%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\left(\frac{y}{y + \left(1 + x\right)} \cdot \frac{1}{y + x}\right)} \]
      2. clear-num99.6%

        \[\leadsto \frac{x}{y + x} \cdot \left(\color{blue}{\frac{1}{\frac{y + \left(1 + x\right)}{y}}} \cdot \frac{1}{y + x}\right) \]
      3. frac-times98.9%

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{1 \cdot 1}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      4. metadata-eval98.9%

        \[\leadsto \frac{x}{y + x} \cdot \frac{\color{blue}{1}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)} \]
      5. div-inv98.9%

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
      6. associate-/r*99.7%

        \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y}}}{y + x}} \]
    6. Taylor expanded in y around inf 72.4%

      \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y + x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification62.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -580:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;y \leq 47000000:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{x + y}\\ \end{array} \]

Alternative 25: 80.3% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -1150:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;y \leq 43000000:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y -1150.0)
   (* (/ y x) (/ 1.0 x))
   (if (<= y 43000000.0) (/ y (* x (+ x 1.0))) (/ (/ x (+ x y)) y))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= -1150.0) {
		tmp = (y / x) * (1.0 / x);
	} else if (y <= 43000000.0) {
		tmp = y / (x * (x + 1.0));
	} else {
		tmp = (x / (x + y)) / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-1150.0d0)) then
        tmp = (y / x) * (1.0d0 / x)
    else if (y <= 43000000.0d0) then
        tmp = y / (x * (x + 1.0d0))
    else
        tmp = (x / (x + y)) / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= -1150.0) {
		tmp = (y / x) * (1.0 / x);
	} else if (y <= 43000000.0) {
		tmp = y / (x * (x + 1.0));
	} else {
		tmp = (x / (x + y)) / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= -1150.0:
		tmp = (y / x) * (1.0 / x)
	elif y <= 43000000.0:
		tmp = y / (x * (x + 1.0))
	else:
		tmp = (x / (x + y)) / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= -1150.0)
		tmp = Float64(Float64(y / x) * Float64(1.0 / x));
	elseif (y <= 43000000.0)
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	else
		tmp = Float64(Float64(x / Float64(x + y)) / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1150.0)
		tmp = (y / x) * (1.0 / x);
	elseif (y <= 43000000.0)
		tmp = y / (x * (x + 1.0));
	else
		tmp = (x / (x + y)) / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, -1150.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 43000000.0], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1150:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\

\mathbf{elif}\;y \leq 43000000:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1150

    1. Initial program 65.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac84.4%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity84.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/84.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity84.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+84.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified84.4%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around inf 30.9%

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{x + \left(y + 1\right)} \]
    5. Taylor expanded in x around inf 29.9%

      \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{y}{x}} \]

    if -1150 < y < 4.3e7

    1. Initial program 73.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac86.2%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity86.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/86.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity86.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+86.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified86.2%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in y around 0 72.7%

      \[\leadsto \color{blue}{\frac{y}{\left(1 + x\right) \cdot x}} \]

    if 4.3e7 < y

    1. Initial program 54.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/68.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. *-commutative68.8%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in63.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def68.8%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult68.8%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified68.8%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/54.7%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-udef52.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult52.8%

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in54.7%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+54.7%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative54.7%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times80.0%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
      8. *-commutative80.0%

        \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. clear-num80.1%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + \left(y + 1\right)}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \]
      10. associate-/r*99.7%

        \[\leadsto \frac{1}{\frac{x + \left(y + 1\right)}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      11. frac-times98.9%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)}} \]
      12. *-un-lft-identity98.9%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
      13. +-commutative98.9%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + x}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
      14. +-commutative98.9%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{\left(y + 1\right) + x}}{y} \cdot \left(x + y\right)} \]
      15. associate-+l+98.9%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{y + \left(1 + x\right)}}{y} \cdot \left(x + y\right)} \]
      16. +-commutative98.9%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \color{blue}{\left(y + x\right)}} \]
    5. Applied egg-rr98.9%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
    6. Taylor expanded in y around -inf 73.5%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + -1 \cdot \left(-1 \cdot \left(1 + x\right) + -1 \cdot x\right)}} \]
    7. Step-by-step derivation
      1. mul-1-neg73.5%

        \[\leadsto \frac{\frac{x}{y + x}}{y + \color{blue}{\left(-\left(-1 \cdot \left(1 + x\right) + -1 \cdot x\right)\right)}} \]
      2. unsub-neg73.5%

        \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y - \left(-1 \cdot \left(1 + x\right) + -1 \cdot x\right)}} \]
      3. neg-mul-173.5%

        \[\leadsto \frac{\frac{x}{y + x}}{y - \left(-1 \cdot \left(1 + x\right) + \color{blue}{\left(-x\right)}\right)} \]
      4. unsub-neg73.5%

        \[\leadsto \frac{\frac{x}{y + x}}{y - \color{blue}{\left(-1 \cdot \left(1 + x\right) - x\right)}} \]
      5. distribute-lft-in73.5%

        \[\leadsto \frac{\frac{x}{y + x}}{y - \left(\color{blue}{\left(-1 \cdot 1 + -1 \cdot x\right)} - x\right)} \]
      6. metadata-eval73.5%

        \[\leadsto \frac{\frac{x}{y + x}}{y - \left(\left(\color{blue}{-1} + -1 \cdot x\right) - x\right)} \]
      7. neg-mul-173.5%

        \[\leadsto \frac{\frac{x}{y + x}}{y - \left(\left(-1 + \color{blue}{\left(-x\right)}\right) - x\right)} \]
      8. unsub-neg73.5%

        \[\leadsto \frac{\frac{x}{y + x}}{y - \left(\color{blue}{\left(-1 - x\right)} - x\right)} \]
    8. Simplified73.5%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y - \left(\left(-1 - x\right) - x\right)}} \]
    9. Taylor expanded in y around inf 72.4%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification62.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1150:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;y \leq 43000000:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \end{array} \]

Alternative 26: 33.0% accurate, 2.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{-156}:\\ \;\;\;\;\frac{y}{x} - y\\ \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.4e-156) (- (/ y x) y) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.4e-156) {
		tmp = (y / x) - y;
	} 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.4d-156)) then
        tmp = (y / x) - y
    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.4e-156) {
		tmp = (y / x) - y;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.4e-156:
		tmp = (y / x) - y
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.4e-156)
		tmp = Float64(Float64(y / x) - y);
	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.4e-156)
		tmp = (y / x) - y;
	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.4e-156], N[(N[(y / x), $MachinePrecision] - y), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-156}:\\
\;\;\;\;\frac{y}{x} - y\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.4000000000000001e-156

    1. Initial program 69.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. Taylor expanded in y around 0 53.8%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(1 + x\right) \cdot {x}^{2}}} \]
    3. Step-by-step derivation
      1. *-commutative53.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{{x}^{2} \cdot \left(1 + x\right)}} \]
      2. unpow253.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x \cdot x\right)} \cdot \left(1 + x\right)} \]
      3. +-commutative53.8%

        \[\leadsto \frac{x \cdot y}{\left(x \cdot x\right) \cdot \color{blue}{\left(x + 1\right)}} \]
    4. Simplified53.8%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x \cdot x\right) \cdot \left(x + 1\right)}} \]
    5. Taylor expanded in x around 0 15.0%

      \[\leadsto \color{blue}{\frac{y}{x} + -1 \cdot y} \]
    6. Step-by-step derivation
      1. neg-mul-115.0%

        \[\leadsto \frac{y}{x} + \color{blue}{\left(-y\right)} \]
      2. unsub-neg15.0%

        \[\leadsto \color{blue}{\frac{y}{x} - y} \]
    7. Simplified15.0%

      \[\leadsto \color{blue}{\frac{y}{x} - y} \]

    if -1.4000000000000001e-156 < x

    1. Initial program 66.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac83.2%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity83.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/83.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity83.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+83.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified83.2%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around 0 57.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. distribute-rgt-in57.8%

        \[\leadsto \frac{x}{\color{blue}{1 \cdot y + y \cdot y}} \]
      2. *-lft-identity57.8%

        \[\leadsto \frac{x}{\color{blue}{y} + y \cdot y} \]
    6. Simplified57.8%

      \[\leadsto \color{blue}{\frac{x}{y + y \cdot y}} \]
    7. Taylor expanded in y around 0 40.7%

      \[\leadsto \frac{x}{\color{blue}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{-156}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 27: 28.5% accurate, 3.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.9:\\ \;\;\;\;\frac{0.5}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (if (<= x -1.9) (/ 0.5 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.9) {
		tmp = 0.5 / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.9d0)) then
        tmp = 0.5d0 / x
    else
        tmp = x / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.9) {
		tmp = 0.5 / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.9:
		tmp = 0.5 / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.9)
		tmp = Float64(0.5 / x);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.9)
		tmp = 0.5 / x;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.9], N[(0.5 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9:\\
\;\;\;\;\frac{0.5}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.8999999999999999

    1. Initial program 63.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/72.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. *-commutative72.5%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in32.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def72.5%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult72.5%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified72.5%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/63.5%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-udef31.9%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult31.9%

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in63.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+63.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative63.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times81.8%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
      8. *-commutative81.8%

        \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. clear-num81.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + \left(y + 1\right)}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \]
      10. associate-/r*99.7%

        \[\leadsto \frac{1}{\frac{x + \left(y + 1\right)}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      11. frac-times97.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)}} \]
      12. *-un-lft-identity97.8%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
      13. +-commutative97.8%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + x}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
      14. +-commutative97.8%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{\left(y + 1\right) + x}}{y} \cdot \left(x + y\right)} \]
      15. associate-+l+97.8%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{y + \left(1 + x\right)}}{y} \cdot \left(x + y\right)} \]
      16. +-commutative97.8%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \color{blue}{\left(y + x\right)}} \]
    5. Applied egg-rr97.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
    6. Taylor expanded in y around -inf 23.6%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + -1 \cdot \left(-1 \cdot \left(1 + x\right) + -1 \cdot x\right)}} \]
    7. Step-by-step derivation
      1. mul-1-neg23.6%

        \[\leadsto \frac{\frac{x}{y + x}}{y + \color{blue}{\left(-\left(-1 \cdot \left(1 + x\right) + -1 \cdot x\right)\right)}} \]
      2. unsub-neg23.6%

        \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y - \left(-1 \cdot \left(1 + x\right) + -1 \cdot x\right)}} \]
      3. neg-mul-123.6%

        \[\leadsto \frac{\frac{x}{y + x}}{y - \left(-1 \cdot \left(1 + x\right) + \color{blue}{\left(-x\right)}\right)} \]
      4. unsub-neg23.6%

        \[\leadsto \frac{\frac{x}{y + x}}{y - \color{blue}{\left(-1 \cdot \left(1 + x\right) - x\right)}} \]
      5. distribute-lft-in23.6%

        \[\leadsto \frac{\frac{x}{y + x}}{y - \left(\color{blue}{\left(-1 \cdot 1 + -1 \cdot x\right)} - x\right)} \]
      6. metadata-eval23.6%

        \[\leadsto \frac{\frac{x}{y + x}}{y - \left(\left(\color{blue}{-1} + -1 \cdot x\right) - x\right)} \]
      7. neg-mul-123.6%

        \[\leadsto \frac{\frac{x}{y + x}}{y - \left(\left(-1 + \color{blue}{\left(-x\right)}\right) - x\right)} \]
      8. unsub-neg23.6%

        \[\leadsto \frac{\frac{x}{y + x}}{y - \left(\color{blue}{\left(-1 - x\right)} - x\right)} \]
    8. Simplified23.6%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y - \left(\left(-1 - x\right) - x\right)}} \]
    9. Taylor expanded in x around inf 5.7%

      \[\leadsto \color{blue}{\frac{0.5}{x}} \]

    if -1.8999999999999999 < x

    1. Initial program 68.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. times-frac85.4%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity85.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/85.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity85.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+85.4%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified85.4%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in x around 0 57.1%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. distribute-rgt-in57.1%

        \[\leadsto \frac{x}{\color{blue}{1 \cdot y + y \cdot y}} \]
      2. *-lft-identity57.1%

        \[\leadsto \frac{x}{\color{blue}{y} + y \cdot y} \]
    6. Simplified57.1%

      \[\leadsto \color{blue}{\frac{x}{y + y \cdot y}} \]
    7. Taylor expanded in y around 0 40.2%

      \[\leadsto \frac{x}{\color{blue}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.9:\\ \;\;\;\;\frac{0.5}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 28: 4.4% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{0.5}{x} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ 0.5 x))
assert(x < y);
double code(double x, double y) {
	return 0.5 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 0.5d0 / x
end function
assert x < y;
public static double code(double x, double y) {
	return 0.5 / x;
}
[x, y] = sort([x, y])
def code(x, y):
	return 0.5 / x
x, y = sort([x, y])
function code(x, y)
	return Float64(0.5 / x)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 0.5 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(0.5 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{0.5}{x}
\end{array}
Derivation
  1. Initial program 67.4%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Step-by-step derivation
    1. associate-*r/77.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    2. *-commutative77.9%

      \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    3. distribute-rgt1-in58.4%

      \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    4. fma-def77.9%

      \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
    5. cube-unmult77.9%

      \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
  3. Simplified77.9%

    \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
  4. Step-by-step derivation
    1. associate-*r/67.4%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    2. fma-udef51.2%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
    3. cube-mult51.2%

      \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    4. distribute-rgt1-in67.4%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    5. associate-+r+67.4%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
    6. *-commutative67.4%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. frac-times84.4%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    8. *-commutative84.4%

      \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
    9. clear-num84.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{x + \left(y + 1\right)}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \]
    10. associate-/r*99.7%

      \[\leadsto \frac{1}{\frac{x + \left(y + 1\right)}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
    11. frac-times98.9%

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)}} \]
    12. *-un-lft-identity98.9%

      \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
    13. +-commutative98.9%

      \[\leadsto \frac{\frac{x}{\color{blue}{y + x}}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)} \]
    14. +-commutative98.9%

      \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{\left(y + 1\right) + x}}{y} \cdot \left(x + y\right)} \]
    15. associate-+l+98.9%

      \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{y + \left(1 + x\right)}}{y} \cdot \left(x + y\right)} \]
    16. +-commutative98.9%

      \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \color{blue}{\left(y + x\right)}} \]
  5. Applied egg-rr98.9%

    \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + \left(1 + x\right)}{y} \cdot \left(y + x\right)}} \]
  6. Taylor expanded in y around -inf 49.7%

    \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + -1 \cdot \left(-1 \cdot \left(1 + x\right) + -1 \cdot x\right)}} \]
  7. Step-by-step derivation
    1. mul-1-neg49.7%

      \[\leadsto \frac{\frac{x}{y + x}}{y + \color{blue}{\left(-\left(-1 \cdot \left(1 + x\right) + -1 \cdot x\right)\right)}} \]
    2. unsub-neg49.7%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y - \left(-1 \cdot \left(1 + x\right) + -1 \cdot x\right)}} \]
    3. neg-mul-149.7%

      \[\leadsto \frac{\frac{x}{y + x}}{y - \left(-1 \cdot \left(1 + x\right) + \color{blue}{\left(-x\right)}\right)} \]
    4. unsub-neg49.7%

      \[\leadsto \frac{\frac{x}{y + x}}{y - \color{blue}{\left(-1 \cdot \left(1 + x\right) - x\right)}} \]
    5. distribute-lft-in49.7%

      \[\leadsto \frac{\frac{x}{y + x}}{y - \left(\color{blue}{\left(-1 \cdot 1 + -1 \cdot x\right)} - x\right)} \]
    6. metadata-eval49.7%

      \[\leadsto \frac{\frac{x}{y + x}}{y - \left(\left(\color{blue}{-1} + -1 \cdot x\right) - x\right)} \]
    7. neg-mul-149.7%

      \[\leadsto \frac{\frac{x}{y + x}}{y - \left(\left(-1 + \color{blue}{\left(-x\right)}\right) - x\right)} \]
    8. unsub-neg49.7%

      \[\leadsto \frac{\frac{x}{y + x}}{y - \left(\color{blue}{\left(-1 - x\right)} - x\right)} \]
  8. Simplified49.7%

    \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y - \left(\left(-1 - x\right) - x\right)}} \]
  9. Taylor expanded in x around inf 4.3%

    \[\leadsto \color{blue}{\frac{0.5}{x}} \]
  10. Final simplification4.3%

    \[\leadsto \frac{0.5}{x} \]

Developer target: 99.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x / ((y + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y):
	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y)
	return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x))))
end
function tmp = code(x, y)
	tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}

Reproduce

?
herbie shell --seed 2023224 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

  (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))