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

Percentage Accurate: 69.7% → 99.8%
Time: 14.8s
Alternatives: 12
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 12 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.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 94.1% accurate, 0.6× speedup?

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

\mathbf{elif}\;x \leq -2.05 \cdot 10^{-13}:\\
\;\;\;\;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{t\_0}{\left(y + x\right) \cdot \frac{y + 1}{x}}\\


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

    1. Initial program 66.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.15999999999999995e85 < x < -2.0500000000000001e-13

    1. Initial program 78.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*94.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+94.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. Simplified94.6%

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

    if -2.0500000000000001e-13 < x

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.16 \cdot 10^{+85}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{y + x}\\ \mathbf{elif}\;x \leq -2.05 \cdot 10^{-13}:\\ \;\;\;\;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{y}{y + x}}{\left(y + x\right) \cdot \frac{y + 1}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 95.6% accurate, 0.8× speedup?

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

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


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

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

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

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

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

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

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

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

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

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

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

    if 7.79999999999999962e174 < y

    1. Initial program 61.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 92.0% accurate, 0.8× speedup?

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

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


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

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.80000000000000004 < x

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 82.5% accurate, 1.1× speedup?

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

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


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

    1. Initial program 72.3%

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

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

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

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

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

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

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

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

    if 1.10000000000000002e-88 < y

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 82.3% accurate, 1.2× speedup?

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

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


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

    1. Initial program 72.3%

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

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

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

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

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

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

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

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

    if 1.10000000000000002e-88 < y

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{y + x} \cdot \frac{\color{blue}{1 \cdot y}}{y \cdot \frac{y + 1}{x}} \]
      6. *-commutative64.3%

        \[\leadsto \frac{1}{y + x} \cdot \frac{1 \cdot y}{\color{blue}{\frac{y + 1}{x} \cdot y}} \]
      7. times-frac64.6%

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

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

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

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

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

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

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

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

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

Alternative 7: 65.4% accurate, 1.4× speedup?

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

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


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

    1. Initial program 71.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*86.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+86.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. Simplified86.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 56.6%

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

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

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

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

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

    if 4.5e-95 < y

    1. Initial program 69.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*81.4%

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

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

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

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

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

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

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

Alternative 8: 78.9% accurate, 1.4× speedup?

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

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


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

    1. Initial program 72.3%

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

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

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

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

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

    if 9.99999999999999934e-89 < y

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

Alternative 9: 80.9% accurate, 1.4× speedup?

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

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


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

    1. Initial program 72.3%

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

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

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

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

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

    if 9.99999999999999934e-89 < y

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

      \[\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}\;y \leq 10^{-88}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 82.1% accurate, 1.4× speedup?

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

    1. Initial program 72.3%

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

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

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

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

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

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

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

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

    if 1.10000000000000002e-88 < y

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

Alternative 11: 43.7% accurate, 2.1× speedup?

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

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


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

    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*88.9%

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

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

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

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

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

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

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

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

    if -4.3049999999999998e-172 < x

    1. Initial program 70.8%

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

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

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

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

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

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

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

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

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

Alternative 12: 26.1% accurate, 5.7× speedup?

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

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

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

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

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

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

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

Developer target: 99.8% accurate, 0.9× speedup?

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

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

Reproduce

?
herbie shell --seed 2024077 
(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))))