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

Percentage Accurate: 69.0% → 99.8%
Time: 14.6s
Alternatives: 15
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 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.0% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 91.4% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 43.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.75000000000000012e101 < x < -1.59999999999999988e-162

    1. Initial program 82.9%

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

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

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

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

    if -1.59999999999999988e-162 < x

    1. Initial program 63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.3% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999991e111 < x < 3.65000000000000021e-47

    1. Initial program 72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.65000000000000021e-47 < x

    1. Initial program 61.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.0% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 45.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.35e141 < x < 3.65000000000000021e-47

    1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

    if 3.65000000000000021e-47 < x

    1. Initial program 61.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 84.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 45.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.4e72 < x < -4.0999999999999998e-55

    1. Initial program 82.7%

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

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

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

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

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

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

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

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

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

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

    if -4.0999999999999998e-55 < x

    1. Initial program 66.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 85.7% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 45.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.35e141 < x < -1.20000000000000007e-54

    1. Initial program 69.3%

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

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

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

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

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

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

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

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

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

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

    if -1.20000000000000007e-54 < x

    1. Initial program 66.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 99.4% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 82.5% accurate, 1.2× speedup?

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

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


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

    1. Initial program 57.7%

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

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

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

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

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

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

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

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

    if -2.2999999999999999e-54 < x

    1. Initial program 66.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 82.6% accurate, 1.2× speedup?

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

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


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

    1. Initial program 57.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.2000000000000001e-55 < x

    1. Initial program 66.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 78.9% accurate, 1.4× speedup?

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

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


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

    1. Initial program 57.7%

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

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

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

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

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

    if -2.2999999999999999e-54 < x

    1. Initial program 66.1%

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

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

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

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

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

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

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

Alternative 11: 80.4% accurate, 1.4× speedup?

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

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


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

    1. Initial program 57.7%

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

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

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

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

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

    if -2.2999999999999999e-54 < x

    1. Initial program 66.1%

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

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

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

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

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

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

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

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

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

Alternative 12: 82.4% accurate, 1.4× speedup?

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

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


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

    1. Initial program 57.7%

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

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

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

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

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

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

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

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

    if -1.74999999999999991e-54 < x

    1. Initial program 66.1%

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

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

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

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

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

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

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

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

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

Alternative 13: 49.2% accurate, 2.4× speedup?

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

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

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

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

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

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

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

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

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

Alternative 14: 26.5% accurate, 5.7× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \frac{x}{\color{blue}{y}} \]
  9. Final simplification21.7%

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

Alternative 15: 3.4% accurate, 8.5× speedup?

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-1 \cdot x} \]
  10. Step-by-step derivation
    1. neg-mul-13.4%

      \[\leadsto \color{blue}{-x} \]
  11. Simplified3.4%

    \[\leadsto \color{blue}{-x} \]
  12. Final simplification3.4%

    \[\leadsto -x \]
  13. Add Preprocessing

Developer target: 99.8% accurate, 0.9× speedup?

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

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

Reproduce

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

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

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