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

Percentage Accurate: 68.6% → 93.4%
Time: 12.8s
Alternatives: 12
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 68.6% 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: 93.4% accurate, 0.8× speedup?

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

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


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

    1. Initial program 61.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*71.8%

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

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

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

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

        \[\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. *-commutative61.4%

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}}\right)}^{2}} \]
    6. Applied egg-rr0.0%

      \[\leadsto \color{blue}{{\left(\frac{\sqrt{x \cdot y}}{\mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)}\right)}^{2}} \]
    7. Taylor expanded in x around inf 48.0%

      \[\leadsto {\color{blue}{\left(\frac{1}{x} \cdot \sqrt{y}\right)}}^{2} \]
    8. Step-by-step derivation
      1. unpow248.0%

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

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

        \[\leadsto \color{blue}{\left(\left(\frac{1}{x} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right) \cdot \frac{1}{x}} \]
      4. associate-*r*48.0%

        \[\leadsto \color{blue}{\left(\frac{1}{x} \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)\right)} \cdot \frac{1}{x} \]
      5. add-sqr-sqrt86.2%

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

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

        \[\leadsto \color{blue}{\frac{y}{x}} \cdot \frac{1}{x} \]
    9. Applied egg-rr86.2%

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

    if -1.1499999999999999e67 < x

    1. Initial program 70.2%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 90.7% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 61.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*71.8%

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

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

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

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

        \[\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. *-commutative61.4%

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}}\right)}^{2}} \]
    6. Applied egg-rr0.0%

      \[\leadsto \color{blue}{{\left(\frac{\sqrt{x \cdot y}}{\mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)}\right)}^{2}} \]
    7. Taylor expanded in x around inf 48.0%

      \[\leadsto {\color{blue}{\left(\frac{1}{x} \cdot \sqrt{y}\right)}}^{2} \]
    8. Step-by-step derivation
      1. unpow248.0%

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

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

        \[\leadsto \color{blue}{\left(\left(\frac{1}{x} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right) \cdot \frac{1}{x}} \]
      4. associate-*r*48.0%

        \[\leadsto \color{blue}{\left(\frac{1}{x} \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)\right)} \cdot \frac{1}{x} \]
      5. add-sqr-sqrt86.2%

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

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

        \[\leadsto \color{blue}{\frac{y}{x}} \cdot \frac{1}{x} \]
    9. Applied egg-rr86.2%

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

    if -1.1000000000000001e69 < x < -3.1499999999999998e-180

    1. Initial program 81.5%

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

    if -3.1499999999999998e-180 < x

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{y + 1}}{\color{blue}{y + x}} \]
    13. Applied egg-rr62.5%

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

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

Alternative 3: 75.0% accurate, 0.8× speedup?

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

\mathbf{elif}\;x \leq -1.42 \cdot 10^{-98}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{elif}\;x \leq 6 \cdot 10^{-144}:\\
\;\;\;\;\frac{x}{y}\\

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


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

    1. Initial program 62.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*72.8%

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/62.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+62.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. *-commutative62.0%

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

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

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{{\left(x + y\right)}^{3}}} \]
      6. fma-undefine62.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      7. add-sqr-sqrt54.5%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}}\right)}^{2}} \]
    6. Applied egg-rr0.0%

      \[\leadsto \color{blue}{{\left(\frac{\sqrt{x \cdot y}}{\mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)}\right)}^{2}} \]
    7. Taylor expanded in x around inf 44.6%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} \cdot \color{blue}{y}}{x} \]
      7. *-commutative78.8%

        \[\leadsto \frac{\color{blue}{y \cdot \frac{1}{x}}}{x} \]
      8. un-div-inv78.8%

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x} \]
    9. Applied egg-rr78.8%

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

    if -1 < x < -1.41999999999999999e-98

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

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

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

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

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

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

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

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

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

    if -1.41999999999999999e-98 < x < 5.9999999999999997e-144

    1. Initial program 73.1%

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

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

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

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

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

    if 5.9999999999999997e-144 < x

    1. Initial program 65.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*80.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+80.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. Simplified80.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 x around 0 42.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y + 1} \cdot \frac{x}{y}} \]
    10. Step-by-step derivation
      1. *-commutative45.9%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y + 1}} \]
    11. Simplified45.9%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y + 1}} \]
    12. Taylor expanded in y around inf 40.2%

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

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

Alternative 4: 75.0% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq 4.7 \cdot 10^{-147}:\\
\;\;\;\;\frac{x}{y}\\

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


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

    1. Initial program 62.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*72.8%

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/62.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+62.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. *-commutative62.0%

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

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

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{{\left(x + y\right)}^{3}}} \]
      6. fma-undefine62.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      7. add-sqr-sqrt54.5%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}}\right)}^{2}} \]
    6. Applied egg-rr0.0%

      \[\leadsto \color{blue}{{\left(\frac{\sqrt{x \cdot y}}{\mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)}\right)}^{2}} \]
    7. Taylor expanded in x around inf 44.6%

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

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

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

        \[\leadsto \color{blue}{\left(\left(\frac{1}{x} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right) \cdot \frac{1}{x}} \]
      4. associate-*r*44.6%

        \[\leadsto \color{blue}{\left(\frac{1}{x} \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)\right)} \cdot \frac{1}{x} \]
      5. add-sqr-sqrt78.8%

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

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

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

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

    if -1 < x < -4.5000000000000001e-97

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

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

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

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

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

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

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

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

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

    if -4.5000000000000001e-97 < x < 4.69999999999999989e-147

    1. Initial program 73.1%

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

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

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

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

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

    if 4.69999999999999989e-147 < x

    1. Initial program 65.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*80.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+80.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. Simplified80.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 x around 0 42.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y + 1} \cdot \frac{x}{y}} \]
    10. Step-by-step derivation
      1. *-commutative45.9%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y + 1}} \]
    11. Simplified45.9%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y + 1}} \]
    12. Taylor expanded in y around inf 40.2%

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

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

Alternative 5: 79.8% accurate, 1.0× speedup?

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

\mathbf{elif}\;x \leq -5 \cdot 10^{-84}:\\
\;\;\;\;\frac{y}{x}\\

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


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

    1. Initial program 62.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*72.8%

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/62.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+62.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. *-commutative62.0%

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

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

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{{\left(x + y\right)}^{3}}} \]
      6. fma-undefine62.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      7. add-sqr-sqrt54.5%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}}\right)}^{2}} \]
    6. Applied egg-rr0.0%

      \[\leadsto \color{blue}{{\left(\frac{\sqrt{x \cdot y}}{\mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)}\right)}^{2}} \]
    7. Taylor expanded in x around inf 44.6%

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

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

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

        \[\leadsto \color{blue}{\left(\left(\frac{1}{x} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right) \cdot \frac{1}{x}} \]
      4. associate-*r*44.6%

        \[\leadsto \color{blue}{\left(\frac{1}{x} \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)\right)} \cdot \frac{1}{x} \]
      5. add-sqr-sqrt78.8%

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

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

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

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

    if -1 < x < -5.0000000000000002e-84

    1. Initial program 93.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*99.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+99.5%

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

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

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

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

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

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

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

    if -5.0000000000000002e-84 < x

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 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)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification67.3%

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

Alternative 6: 80.8% accurate, 1.0× speedup?

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

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

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


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

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+77.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. Simplified77.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. Step-by-step derivation
      1. associate-*r/63.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+63.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. *-commutative63.9%

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

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

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{{\left(x + y\right)}^{3}}} \]
      6. fma-undefine63.9%

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

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}}\right)}^{2}} \]
    6. Applied egg-rr0.0%

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

      \[\leadsto {\color{blue}{\left(\frac{1}{x} \cdot \sqrt{y}\right)}}^{2} \]
    8. Step-by-step derivation
      1. unpow255.7%

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

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

        \[\leadsto \color{blue}{\left(\left(\frac{1}{x} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right) \cdot \frac{1}{x}} \]
      4. associate-*r*55.7%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{x}} \cdot \frac{1}{x} \]
    9. Applied egg-rr93.2%

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

    if -4.99999999999999967e145 < x < -3.60000000000000003e-84

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+76.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. Simplified76.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 59.0%

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

    if -3.60000000000000003e-84 < x

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 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)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification67.3%

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

Alternative 7: 82.2% accurate, 1.0× speedup?

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

\mathbf{elif}\;x \leq -4.5 \cdot 10^{-84}:\\
\;\;\;\;\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 3 regimes
  2. if x < -1e143

    1. Initial program 62.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*76.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+76.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. Simplified76.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. Step-by-step derivation
      1. associate-*r/62.6%

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

        \[\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. *-commutative62.6%

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

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

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

        \[\leadsto \frac{x \cdot y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      7. add-sqr-sqrt62.6%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}}\right)}^{2}} \]
    6. Applied egg-rr0.0%

      \[\leadsto \color{blue}{{\left(\frac{\sqrt{x \cdot y}}{\mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)}\right)}^{2}} \]
    7. Taylor expanded in x around inf 54.5%

      \[\leadsto {\color{blue}{\left(\frac{1}{x} \cdot \sqrt{y}\right)}}^{2} \]
    8. Step-by-step derivation
      1. unpow254.5%

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

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

        \[\leadsto \color{blue}{\left(\left(\frac{1}{x} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right) \cdot \frac{1}{x}} \]
      4. associate-*r*54.5%

        \[\leadsto \color{blue}{\left(\frac{1}{x} \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)\right)} \cdot \frac{1}{x} \]
      5. add-sqr-sqrt91.2%

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

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

        \[\leadsto \color{blue}{\frac{y}{x}} \cdot \frac{1}{x} \]
    9. Applied egg-rr91.3%

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

    if -1e143 < x < -4.50000000000000016e-84

    1. Initial program 71.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*78.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+78.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. Simplified78.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 y around 0 60.1%

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

    if -4.50000000000000016e-84 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 66.4% accurate, 1.3× speedup?

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

\mathbf{elif}\;x \leq -2.6 \cdot 10^{-101}:\\
\;\;\;\;\frac{y}{x}\\

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


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

    1. Initial program 62.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*72.8%

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/62.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+62.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. *-commutative62.0%

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

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

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{{\left(x + y\right)}^{3}}} \]
      6. fma-undefine62.0%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      7. add-sqr-sqrt54.5%

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

        \[\leadsto \color{blue}{{\left(\sqrt{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}}\right)}^{2}} \]
    6. Applied egg-rr0.0%

      \[\leadsto \color{blue}{{\left(\frac{\sqrt{x \cdot y}}{\mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)}\right)}^{2}} \]
    7. Taylor expanded in x around inf 44.6%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{1}{x} \cdot \color{blue}{y}}{x} \]
      7. *-commutative78.8%

        \[\leadsto \frac{\color{blue}{y \cdot \frac{1}{x}}}{x} \]
      8. un-div-inv78.8%

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x} \]
    9. Applied egg-rr78.8%

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

    if -1 < x < -2.6000000000000001e-101

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

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

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

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

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

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

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

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

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

    if -2.6000000000000001e-101 < x

    1. Initial program 68.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*81.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+81.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. Simplified81.2%

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

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

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

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

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

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

Alternative 9: 82.2% accurate, 1.4× speedup?

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

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


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

    1. Initial program 67.3%

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

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

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

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

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

    if -3.60000000000000003e-84 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 43.6% accurate, 2.1× speedup?

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

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


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

    1. Initial program 67.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*77.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+77.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. Simplified77.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 68.7%

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

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

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

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

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

    if -7.5e-97 < x

    1. Initial program 68.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*81.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+81.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. Simplified81.2%

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

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

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

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

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

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

Alternative 11: 26.4% accurate, 5.7× speedup?

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

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

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

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

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

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

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

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

Alternative 12: 3.5% accurate, 17.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  13. Final simplification3.5%

    \[\leadsto 1 \]
  14. 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 2024059 
(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))))