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

Percentage Accurate: 69.3% → 99.8%
Time: 12.9s
Alternatives: 15
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

      \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    4. +-commutative95.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+95.1%

      \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    6. +-commutative95.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+95.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-rr95.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. *-commutative95.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 82.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}\;y \leq 1.15 \cdot 10^{-86}:\\ \;\;\;\;\frac{\frac{y}{x}}{t\_0}\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{-25} \lor \neg \left(y \leq 0.0066\right):\\ \;\;\;\;\frac{x}{y + x} \cdot \frac{1}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ y (+ x 1.0))))
   (if (<= y 1.15e-86)
     (/ (/ y x) t_0)
     (if (or (<= y 4.1e-25) (not (<= y 0.0066)))
       (* (/ x (+ y x)) (/ 1.0 t_0))
       (/ y (* x (+ x 1.0)))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y + (x + 1.0);
	double tmp;
	if (y <= 1.15e-86) {
		tmp = (y / x) / t_0;
	} else if ((y <= 4.1e-25) || !(y <= 0.0066)) {
		tmp = (x / (y + x)) * (1.0 / t_0);
	} else {
		tmp = y / (x * (x + 1.0));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y + (x + 1.0d0)
    if (y <= 1.15d-86) then
        tmp = (y / x) / t_0
    else if ((y <= 4.1d-25) .or. (.not. (y <= 0.0066d0))) then
        tmp = (x / (y + x)) * (1.0d0 / t_0)
    else
        tmp = y / (x * (x + 1.0d0))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y + (x + 1.0);
	double tmp;
	if (y <= 1.15e-86) {
		tmp = (y / x) / t_0;
	} else if ((y <= 4.1e-25) || !(y <= 0.0066)) {
		tmp = (x / (y + x)) * (1.0 / t_0);
	} else {
		tmp = y / (x * (x + 1.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y + (x + 1.0)
	tmp = 0
	if y <= 1.15e-86:
		tmp = (y / x) / t_0
	elif (y <= 4.1e-25) or not (y <= 0.0066):
		tmp = (x / (y + x)) * (1.0 / t_0)
	else:
		tmp = y / (x * (x + 1.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y + Float64(x + 1.0))
	tmp = 0.0
	if (y <= 1.15e-86)
		tmp = Float64(Float64(y / x) / t_0);
	elseif ((y <= 4.1e-25) || !(y <= 0.0066))
		tmp = Float64(Float64(x / Float64(y + x)) * Float64(1.0 / t_0));
	else
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y + (x + 1.0);
	tmp = 0.0;
	if (y <= 1.15e-86)
		tmp = (y / x) / t_0;
	elseif ((y <= 4.1e-25) || ~((y <= 0.0066)))
		tmp = (x / (y + x)) * (1.0 / t_0);
	else
		tmp = y / (x * (x + 1.0));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.15e-86], N[(N[(y / x), $MachinePrecision] / t$95$0), $MachinePrecision], If[Or[LessEqual[y, 4.1e-25], N[Not[LessEqual[y, 0.0066]], $MachinePrecision]], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 1.15 \cdot 10^{-86}:\\
\;\;\;\;\frac{\frac{y}{x}}{t\_0}\\

\mathbf{elif}\;y \leq 4.1 \cdot 10^{-25} \lor \neg \left(y \leq 0.0066\right):\\
\;\;\;\;\frac{x}{y + x} \cdot \frac{1}{t\_0}\\

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


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

    1. Initial program 74.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*85.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+85.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. Simplified85.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. Step-by-step derivation
      1. associate-*r/74.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.14999999999999998e-86 < y < 4.09999999999999987e-25 or 0.0066 < y

    1. Initial program 72.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*72.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-frac94.7%

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

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      4. +-commutative94.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+94.7%

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      6. +-commutative94.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+94.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-rr94.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. *-commutative94.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.09999999999999987e-25 < y < 0.0066

    1. Initial program 56.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*56.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+56.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. Simplified56.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.15 \cdot 10^{-86}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + \left(x + 1\right)}\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{-25} \lor \neg \left(y \leq 0.0066\right):\\ \;\;\;\;\frac{x}{y + x} \cdot \frac{1}{y + \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 91.5% 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}\;y \leq 3.8 \cdot 10^{-156}:\\ \;\;\;\;\frac{\frac{y}{x}}{t\_0}\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{+112}:\\ \;\;\;\;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{x}{y + x} \cdot \frac{1}{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 3.8e-156)
     (/ (/ y x) t_0)
     (if (<= y 3.9e+112)
       (* x (/ y (* (* (+ y x) (+ y x)) (+ x (+ y 1.0)))))
       (* (/ x (+ y x)) (/ 1.0 t_0))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y + (x + 1.0);
	double tmp;
	if (y <= 3.8e-156) {
		tmp = (y / x) / t_0;
	} else if (y <= 3.9e+112) {
		tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
	} else {
		tmp = (x / (y + x)) * (1.0 / 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 <= 3.8d-156) then
        tmp = (y / x) / t_0
    else if (y <= 3.9d+112) then
        tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0d0))))
    else
        tmp = (x / (y + x)) * (1.0d0 / 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 <= 3.8e-156) {
		tmp = (y / x) / t_0;
	} else if (y <= 3.9e+112) {
		tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
	} else {
		tmp = (x / (y + x)) * (1.0 / t_0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y + (x + 1.0)
	tmp = 0
	if y <= 3.8e-156:
		tmp = (y / x) / t_0
	elif y <= 3.9e+112:
		tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))))
	else:
		tmp = (x / (y + x)) * (1.0 / 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 <= 3.8e-156)
		tmp = Float64(Float64(y / x) / t_0);
	elseif (y <= 3.9e+112)
		tmp = Float64(x * Float64(y / Float64(Float64(Float64(y + x) * Float64(y + x)) * Float64(x + Float64(y + 1.0)))));
	else
		tmp = Float64(Float64(x / Float64(y + x)) * Float64(1.0 / 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 <= 3.8e-156)
		tmp = (y / x) / t_0;
	elseif (y <= 3.9e+112)
		tmp = x * (y / (((y + x) * (y + x)) * (x + (y + 1.0))));
	else
		tmp = (x / (y + x)) * (1.0 / 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, 3.8e-156], N[(N[(y / x), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y, 3.9e+112], 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 / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 3.8 \cdot 10^{-156}:\\
\;\;\;\;\frac{\frac{y}{x}}{t\_0}\\

\mathbf{elif}\;y \leq 3.9 \cdot 10^{+112}:\\
\;\;\;\;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{x}{y + x} \cdot \frac{1}{t\_0}\\


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

    1. Initial program 74.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.80000000000000008e-156 < y < 3.89999999999999968e112

    1. Initial program 75.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*83.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+83.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. Simplified83.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 3.89999999999999968e112 < 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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*69.9%

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

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

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      4. +-commutative94.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+94.6%

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      6. +-commutative94.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+94.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-rr94.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. *-commutative94.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 82.2% accurate, 0.7× speedup?

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

\mathbf{elif}\;y \leq 5 \cdot 10^{-25} \lor \neg \left(y \leq 0.00052\right):\\
\;\;\;\;\frac{x}{y + x} \cdot \frac{1}{y + 1}\\

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


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

    1. Initial program 74.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*85.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+85.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. Simplified85.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. Step-by-step derivation
      1. associate-*r/74.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1000000000000001e-86 < y < 4.99999999999999962e-25 or 5.19999999999999954e-4 < y

    1. Initial program 71.4%

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

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

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

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      4. +-commutative94.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+94.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      6. +-commutative94.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+94.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-rr94.8%

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

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

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

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

    if 4.99999999999999962e-25 < y < 5.19999999999999954e-4

    1. Initial program 71.0%

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

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

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

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

Alternative 5: 78.6% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{if}\;y \leq 4.8 \cdot 10^{-88}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 0.00062:\\ \;\;\;\;t\_0\\ \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
 (let* ((t_0 (/ y (* x (+ x 1.0)))))
   (if (<= y 4.8e-88)
     t_0
     (if (<= y 4.5e-25)
       (/ x y)
       (if (<= y 0.00062) t_0 (/ x (* y (+ y 1.0))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (y <= 4.8e-88) {
		tmp = t_0;
	} else if (y <= 4.5e-25) {
		tmp = x / y;
	} else if (y <= 0.00062) {
		tmp = t_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) :: t_0
    real(8) :: tmp
    t_0 = y / (x * (x + 1.0d0))
    if (y <= 4.8d-88) then
        tmp = t_0
    else if (y <= 4.5d-25) then
        tmp = x / y
    else if (y <= 0.00062d0) then
        tmp = t_0
    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 t_0 = y / (x * (x + 1.0));
	double tmp;
	if (y <= 4.8e-88) {
		tmp = t_0;
	} else if (y <= 4.5e-25) {
		tmp = x / y;
	} else if (y <= 0.00062) {
		tmp = t_0;
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * (x + 1.0))
	tmp = 0
	if y <= 4.8e-88:
		tmp = t_0
	elif y <= 4.5e-25:
		tmp = x / y
	elif y <= 0.00062:
		tmp = t_0
	else:
		tmp = x / (y * (y + 1.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x * Float64(x + 1.0)))
	tmp = 0.0
	if (y <= 4.8e-88)
		tmp = t_0;
	elseif (y <= 4.5e-25)
		tmp = Float64(x / y);
	elseif (y <= 0.00062)
		tmp = t_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)
	t_0 = y / (x * (x + 1.0));
	tmp = 0.0;
	if (y <= 4.8e-88)
		tmp = t_0;
	elseif (y <= 4.5e-25)
		tmp = x / y;
	elseif (y <= 0.00062)
		tmp = t_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_] := Block[{t$95$0 = N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 4.8e-88], t$95$0, If[LessEqual[y, 4.5e-25], N[(x / y), $MachinePrecision], If[LessEqual[y, 0.00062], t$95$0, N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;y \leq 4.8 \cdot 10^{-88}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 4.5 \cdot 10^{-25}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;y \leq 0.00062:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 4.7999999999999999e-88 or 4.5000000000000001e-25 < y < 6.2e-4

    1. Initial program 74.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*85.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+85.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. Simplified85.4%

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

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

    if 4.7999999999999999e-88 < y < 4.5000000000000001e-25

    1. Initial program 85.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*91.1%

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

        \[\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. Simplified91.1%

      \[\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 62.5%

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

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

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

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

    if 6.2e-4 < y

    1. Initial program 69.1%

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

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

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

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

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

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

Alternative 6: 80.8% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{if}\;y \leq 1.15 \cdot 10^{-86}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 0.000125:\\ \;\;\;\;t\_0\\ \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
 (let* ((t_0 (/ y (* x (+ x 1.0)))))
   (if (<= y 1.15e-86)
     t_0
     (if (<= y 3.8e-25)
       (/ x y)
       (if (<= y 0.000125) t_0 (/ (/ x y) (+ y 1.0)))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (y <= 1.15e-86) {
		tmp = t_0;
	} else if (y <= 3.8e-25) {
		tmp = x / y;
	} else if (y <= 0.000125) {
		tmp = t_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) :: t_0
    real(8) :: tmp
    t_0 = y / (x * (x + 1.0d0))
    if (y <= 1.15d-86) then
        tmp = t_0
    else if (y <= 3.8d-25) then
        tmp = x / y
    else if (y <= 0.000125d0) then
        tmp = t_0
    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 t_0 = y / (x * (x + 1.0));
	double tmp;
	if (y <= 1.15e-86) {
		tmp = t_0;
	} else if (y <= 3.8e-25) {
		tmp = x / y;
	} else if (y <= 0.000125) {
		tmp = t_0;
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * (x + 1.0))
	tmp = 0
	if y <= 1.15e-86:
		tmp = t_0
	elif y <= 3.8e-25:
		tmp = x / y
	elif y <= 0.000125:
		tmp = t_0
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x * Float64(x + 1.0)))
	tmp = 0.0
	if (y <= 1.15e-86)
		tmp = t_0;
	elseif (y <= 3.8e-25)
		tmp = Float64(x / y);
	elseif (y <= 0.000125)
		tmp = t_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)
	t_0 = y / (x * (x + 1.0));
	tmp = 0.0;
	if (y <= 1.15e-86)
		tmp = t_0;
	elseif (y <= 3.8e-25)
		tmp = x / y;
	elseif (y <= 0.000125)
		tmp = t_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_] := Block[{t$95$0 = N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.15e-86], t$95$0, If[LessEqual[y, 3.8e-25], N[(x / y), $MachinePrecision], If[LessEqual[y, 0.000125], t$95$0, N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;y \leq 1.15 \cdot 10^{-86}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 3.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;y \leq 0.000125:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.14999999999999998e-86 or 3.7999999999999998e-25 < y < 1.25e-4

    1. Initial program 74.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*85.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+85.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. Simplified85.4%

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

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

    if 1.14999999999999998e-86 < y < 3.7999999999999998e-25

    1. Initial program 85.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*91.1%

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

        \[\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. Simplified91.1%

      \[\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 62.5%

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

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

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

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

    if 1.25e-4 < y

    1. Initial program 69.1%

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\frac{\frac{1}{y}}{y + 1}} \]
    8. Step-by-step derivation
      1. associate-*r/72.6%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{1}{y}}{y + 1}} \]
      2. un-div-inv72.7%

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

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

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

Alternative 7: 82.0% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.15 \cdot 10^{-86}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 0.00078:\\ \;\;\;\;\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 1.15e-86)
   (/ (/ y x) (+ x 1.0))
   (if (<= y 4e-25)
     (/ x y)
     (if (<= y 0.00078) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 1.15e-86) {
		tmp = (y / x) / (x + 1.0);
	} else if (y <= 4e-25) {
		tmp = x / y;
	} else if (y <= 0.00078) {
		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.15d-86) then
        tmp = (y / x) / (x + 1.0d0)
    else if (y <= 4d-25) then
        tmp = x / y
    else if (y <= 0.00078d0) 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.15e-86) {
		tmp = (y / x) / (x + 1.0);
	} else if (y <= 4e-25) {
		tmp = x / y;
	} else if (y <= 0.00078) {
		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.15e-86:
		tmp = (y / x) / (x + 1.0)
	elif y <= 4e-25:
		tmp = x / y
	elif y <= 0.00078:
		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.15e-86)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	elseif (y <= 4e-25)
		tmp = Float64(x / y);
	elseif (y <= 0.00078)
		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 <= 1.15e-86)
		tmp = (y / x) / (x + 1.0);
	elseif (y <= 4e-25)
		tmp = x / y;
	elseif (y <= 0.00078)
		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.15e-86], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e-25], N[(x / y), $MachinePrecision], If[LessEqual[y, 0.00078], 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 1.15 \cdot 10^{-86}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

\mathbf{elif}\;y \leq 4 \cdot 10^{-25}:\\
\;\;\;\;\frac{x}{y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 1.14999999999999998e-86

    1. Initial program 74.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*85.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+85.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. Simplified85.6%

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

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

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

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

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

    if 1.14999999999999998e-86 < y < 4.00000000000000015e-25

    1. Initial program 85.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*91.1%

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

        \[\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. Simplified91.1%

      \[\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 62.5%

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

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

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

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

    if 4.00000000000000015e-25 < y < 7.79999999999999986e-4

    1. Initial program 71.0%

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

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

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

    if 7.79999999999999986e-4 < y

    1. Initial program 69.1%

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

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\frac{\frac{1}{y}}{y + 1}} \]
    8. Step-by-step derivation
      1. associate-*r/72.6%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{1}{y}}{y + 1}} \]
      2. un-div-inv72.7%

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

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

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

Alternative 8: 82.0% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{-87}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + \left(x + 1\right)}\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 0.0038:\\ \;\;\;\;\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 8e-87)
   (/ (/ y x) (+ y (+ x 1.0)))
   (if (<= y 3.8e-25)
     (/ x y)
     (if (<= y 0.0038) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 8e-87) {
		tmp = (y / x) / (y + (x + 1.0));
	} else if (y <= 3.8e-25) {
		tmp = x / y;
	} else if (y <= 0.0038) {
		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 <= 8d-87) then
        tmp = (y / x) / (y + (x + 1.0d0))
    else if (y <= 3.8d-25) then
        tmp = x / y
    else if (y <= 0.0038d0) 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 <= 8e-87) {
		tmp = (y / x) / (y + (x + 1.0));
	} else if (y <= 3.8e-25) {
		tmp = x / y;
	} else if (y <= 0.0038) {
		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 <= 8e-87:
		tmp = (y / x) / (y + (x + 1.0))
	elif y <= 3.8e-25:
		tmp = x / y
	elif y <= 0.0038:
		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 <= 8e-87)
		tmp = Float64(Float64(y / x) / Float64(y + Float64(x + 1.0)));
	elseif (y <= 3.8e-25)
		tmp = Float64(x / y);
	elseif (y <= 0.0038)
		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 <= 8e-87)
		tmp = (y / x) / (y + (x + 1.0));
	elseif (y <= 3.8e-25)
		tmp = x / y;
	elseif (y <= 0.0038)
		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, 8e-87], N[(N[(y / x), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.8e-25], N[(x / y), $MachinePrecision], If[LessEqual[y, 0.0038], 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 8 \cdot 10^{-87}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + \left(x + 1\right)}\\

\mathbf{elif}\;y \leq 3.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{x}{y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 8.00000000000000014e-87

    1. Initial program 74.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*85.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+85.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. Simplified85.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. Step-by-step derivation
      1. associate-*r/74.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.00000000000000014e-87 < y < 3.7999999999999998e-25

    1. Initial program 85.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*91.1%

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

        \[\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. Simplified91.1%

      \[\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 62.5%

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

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

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

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

    if 3.7999999999999998e-25 < y < 0.00379999999999999999

    1. Initial program 56.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*56.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+56.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. Simplified56.7%

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

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

    if 0.00379999999999999999 < 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*83.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+83.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. Simplified83.9%

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\frac{\frac{1}{y}}{y + 1}} \]
    8. Step-by-step derivation
      1. associate-*r/73.7%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{1}{y}}{y + 1}} \]
      2. un-div-inv73.7%

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

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

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

Alternative 9: 95.7% accurate, 0.8× speedup?

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

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


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

    1. Initial program 55.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*55.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-frac82.1%

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

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      4. +-commutative82.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+82.1%

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      6. +-commutative82.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+82.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-rr82.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. *-commutative82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.9999999999999997e157 < x

    1. Initial program 76.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*76.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-frac96.9%

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 74.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*85.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+85.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. Simplified85.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. Step-by-step derivation
      1. associate-*r/74.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.20000000000000005e-87 < y

    1. Initial program 71.4%

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

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

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

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      4. +-commutative95.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+95.0%

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      6. +-commutative95.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+95.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-rr95.0%

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

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

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

Alternative 11: 66.0% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 6.2 \cdot 10^{-130}:\\ \;\;\;\;\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 6.2e-130) (/ y x) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 6.2e-130) {
		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 <= 6.2d-130) 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 <= 6.2e-130) {
		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 <= 6.2e-130:
		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 <= 6.2e-130)
		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 <= 6.2e-130)
		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, 6.2e-130], 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 6.2 \cdot 10^{-130}:\\
\;\;\;\;\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 < 6.20000000000000021e-130

    1. Initial program 74.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*85.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+85.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. Simplified85.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 y around 0 55.6%

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

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

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

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

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

    if 6.20000000000000021e-130 < y

    1. Initial program 72.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.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+84.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. Simplified84.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 66.6%

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

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

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

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

Alternative 12: 44.6% accurate, 1.7× speedup?

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

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


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

    1. Initial program 74.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*85.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+85.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. Simplified85.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 y around 0 55.6%

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

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

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

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

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

    if 2.1e-129 < y

    1. Initial program 72.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.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+84.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. Simplified84.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. Step-by-step derivation
      1. associate-*r/72.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 28.4% accurate, 2.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -3300000:\\ \;\;\;\;\frac{1}{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 -3300000.0) (/ 1.0 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -3300000.0) {
		tmp = 1.0 / 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 <= (-3300000.0d0)) then
        tmp = 1.0d0 / 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 <= -3300000.0) {
		tmp = 1.0 / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -3300000.0:
		tmp = 1.0 / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -3300000.0)
		tmp = Float64(1.0 / 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 <= -3300000.0)
		tmp = 1.0 / 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, -3300000.0], N[(1.0 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3300000:\\
\;\;\;\;\frac{1}{x}\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.3e6 < x

    1. Initial program 77.4%

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

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

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

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

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

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

Alternative 14: 44.2% accurate, 2.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.3 \cdot 10^{-129}:\\ \;\;\;\;\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 (<= y 1.3e-129) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 1.3e-129) {
		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 (y <= 1.3d-129) 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 (y <= 1.3e-129) {
		tmp = y / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 1.3e-129:
		tmp = y / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 1.3e-129)
		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 (y <= 1.3e-129)
		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[y, 1.3e-129], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.3 \cdot 10^{-129}:\\
\;\;\;\;\frac{y}{x}\\

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


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

    1. Initial program 74.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*85.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+85.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. Simplified85.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 y around 0 55.6%

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

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

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

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

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

    if 1.3e-129 < y

    1. Initial program 72.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.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+84.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. Simplified84.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 66.6%

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

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

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

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

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

Alternative 15: 4.3% accurate, 5.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{x} \]
  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 2024095 
(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))))