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

Percentage Accurate: 69.4% → 99.8%
Time: 14.7s
Alternatives: 21
Speedup: 1.9×

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

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

Initial Program: 69.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.2% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.49999999999999996e-46 < y < 1.35000000000000003e154

    1. Initial program 75.8%

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

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

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

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

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

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

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

    if 1.35000000000000003e154 < y

    1. Initial program 53.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 85.7% accurate, 0.9× speedup?

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

\mathbf{elif}\;y \leq 2.5 \cdot 10^{-18}:\\
\;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \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 y < 5.19999999999999961e-128

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.19999999999999961e-128 < y < 2.50000000000000018e-18

    1. Initial program 86.7%

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

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

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

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

    if 2.50000000000000018e-18 < y

    1. Initial program 64.5%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 80.7% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;x \leq -4.4 \cdot 10^{-103}:\\
\;\;\;\;\frac{y}{x}\\

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

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


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

    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. times-frac85.5%

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{x} \cdot \frac{y}{\color{blue}{x}} \]
    6. Step-by-step derivation
      1. associate-*l/92.3%

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x} \]
    7. Applied egg-rr92.3%

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

    if -6.2000000000000003e164 < x < -2.05000000000000002e39

    1. Initial program 51.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{x + y} \cdot \frac{y}{x + 1}}}{x + y} \]
    8. Simplified62.3%

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

      \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x + y} \]
    10. Step-by-step derivation
      1. expm1-log1p-u61.3%

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

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

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

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

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

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

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

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

    if -2.05000000000000002e39 < x < -2.20000000000000006e-58

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

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

    if -2.20000000000000006e-58 < x < -4.3999999999999999e-103

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

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

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

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

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

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

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

    if -4.3999999999999999e-103 < x < 6e62

    1. Initial program 76.4%

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

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

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

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

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

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

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

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

    if 6e62 < x

    1. Initial program 58.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. associate-*l/20.9%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \]
    10. Simplified20.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.2 \cdot 10^{+164}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -2.05 \cdot 10^{+39}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + y\right)}\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-58}:\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \mathbf{elif}\;x \leq -4.4 \cdot 10^{-103}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq 6 \cdot 10^{+62}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]

Alternative 5: 92.1% accurate, 1.0× speedup?

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

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


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

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.50000000000000018e-18 < y

    1. Initial program 64.5%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.5 \cdot 10^{-18}:\\ \;\;\;\;\frac{\frac{x}{x + y} \cdot \frac{y}{x + 1}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]

Alternative 6: 79.8% accurate, 1.1× speedup?

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

\mathbf{elif}\;x \leq -2 \cdot 10^{-58}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x \leq -4.4 \cdot 10^{-103}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{elif}\;x \leq 2.6 \cdot 10^{+52}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 57.7%

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

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

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

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

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

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

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

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

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

    if -1.25000000000000001e40 < x < -2.0000000000000001e-58 or -4.3999999999999999e-103 < x < 2.6e52

    1. Initial program 78.2%

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

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

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

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

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

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

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

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

    if -2.0000000000000001e-58 < x < -4.3999999999999999e-103

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

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

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

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

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

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

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

    if 2.6e52 < x

    1. Initial program 60.7%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. associate-*l/21.9%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \]
    10. Simplified21.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.25 \cdot 10^{+40}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-58}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -4.4 \cdot 10^{-103}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{+52}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]

Alternative 7: 79.8% accurate, 1.1× speedup?

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

\mathbf{elif}\;x \leq -2 \cdot 10^{-58}:\\
\;\;\;\;\frac{x}{y + y \cdot y}\\

\mathbf{elif}\;x \leq -4.4 \cdot 10^{-103}:\\
\;\;\;\;\frac{y}{x}\\

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

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


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

    1. Initial program 57.7%

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

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

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

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

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

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

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

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

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

    if -1.99999999999999988e39 < x < -2.0000000000000001e-58

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e-58 < x < -4.3999999999999999e-103

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

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

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

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

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

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

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

    if -4.3999999999999999e-103 < x < 3.29999999999999983e58

    1. Initial program 76.3%

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

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

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

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

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

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

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

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

    if 3.29999999999999983e58 < x

    1. Initial program 58.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
    8. Applied egg-rr20.5%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. associate-*l/20.5%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \]
    10. Simplified20.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{+39}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-58}:\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \mathbf{elif}\;x \leq -4.4 \cdot 10^{-103}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+58}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]

Alternative 8: 81.2% accurate, 1.3× speedup?

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

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


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

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.95e-21 < y

    1. Initial program 64.5%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 72.3% accurate, 1.5× speedup?

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

\mathbf{elif}\;y \leq 3.1 \cdot 10^{-127}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{elif}\;y \leq 0.75:\\
\;\;\;\;\frac{x}{y} - x\\

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


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

    1. Initial program 69.4%

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

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

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

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

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

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

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

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

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

    if -5.2000000000000003e-153 < y < 3.1e-127

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

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

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

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

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

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

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

    if 3.1e-127 < y < 0.75

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} - x} \]
    9. Simplified30.5%

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

    if 0.75 < y

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-153}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{-127}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.75:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]

Alternative 10: 74.5% accurate, 1.5× speedup?

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

\mathbf{elif}\;y \leq 1.65 \cdot 10^{-125}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{elif}\;y \leq 0.75:\\
\;\;\;\;\frac{x}{y} - x\\

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


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

    1. Initial program 69.4%

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

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

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

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

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

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

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

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

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

    if -1.2499999999999999e-152 < y < 1.65e-125

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

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

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

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

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

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

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

    if 1.65e-125 < y < 0.75

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} - x} \]
    9. Simplified30.5%

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

    if 0.75 < y

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. associate-*l/77.1%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \]
    10. Simplified77.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.25 \cdot 10^{-152}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{-125}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.75:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]

Alternative 11: 75.9% accurate, 1.5× speedup?

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

\mathbf{elif}\;y \leq 1.7 \cdot 10^{-125}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{elif}\;y \leq 0.76:\\
\;\;\;\;\frac{x}{y} - x\\

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


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

    1. Initial program 69.4%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{x} \cdot \frac{y}{\color{blue}{x}} \]
    6. Step-by-step derivation
      1. associate-*l/37.0%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x}}{x}} \]
      2. *-un-lft-identity37.0%

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

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

    if -8.2000000000000002e-151 < y < 1.69999999999999988e-125

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

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

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

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

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

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

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

    if 1.69999999999999988e-125 < y < 0.76000000000000001

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} - x} \]
    9. Simplified30.5%

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

    if 0.76000000000000001 < y

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. associate-*l/77.1%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \]
    10. Simplified77.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.2 \cdot 10^{-151}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{-125}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.76:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]

Alternative 12: 75.9% accurate, 1.5× speedup?

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

\mathbf{elif}\;y \leq 1.7 \cdot 10^{-125}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{elif}\;y \leq 0.76:\\
\;\;\;\;\frac{x}{y} - x\\

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


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

    1. Initial program 69.4%

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

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

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

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

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

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

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

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

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

    if -6.79999999999999968e-152 < y < 1.69999999999999988e-125

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

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

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

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

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

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

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

    if 1.69999999999999988e-125 < y < 0.76000000000000001

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} - x} \]
    9. Simplified30.5%

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

    if 0.76000000000000001 < y

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. associate-*l/77.1%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \]
    10. Simplified77.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.8 \cdot 10^{-152}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{-125}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.76:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]

Alternative 13: 79.8% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

    if 6.59999999999999968e-24 < y < 5.0000000000000002e151

    1. Initial program 75.0%

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

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

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

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

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

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

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

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

    if 5.0000000000000002e151 < y

    1. Initial program 52.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. associate-*l/81.9%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \]
    10. Simplified81.9%

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

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

Alternative 14: 79.8% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{x \cdot 1 + x \cdot x}} \]
      3. *-rgt-identity58.4%

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

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

    if 7.60000000000000052e-24 < y < 1e152

    1. Initial program 75.0%

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

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

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

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

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

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

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

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

    if 1e152 < y

    1. Initial program 52.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y}} \]
    9. Step-by-step derivation
      1. associate-*l/81.9%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \]
    10. Simplified81.9%

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

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

Alternative 15: 81.1% accurate, 1.5× speedup?

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

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


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

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.40000000000000011e-19 < y

    1. Initial program 64.5%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 7.4 \cdot 10^{-19}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]

Alternative 16: 81.2% accurate, 1.5× speedup?

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

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


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

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

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

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

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

    if 2.49999999999999977e-22 < y

    1. Initial program 64.5%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 64.9% accurate, 1.9× speedup?

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

\mathbf{elif}\;y \leq 0.76:\\
\;\;\;\;\frac{x}{y} - x\\

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


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

    1. Initial program 69.7%

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

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

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

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

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

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

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

    if 2.40000000000000007e-126 < y < 0.76000000000000001

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} - x} \]
    9. Simplified30.5%

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

    if 0.76000000000000001 < y

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.4 \cdot 10^{-126}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 0.76:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]

Alternative 18: 79.8% accurate, 1.9× speedup?

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

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


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

    1. Initial program 71.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{x \cdot 1 + x \cdot x}} \]
      3. *-rgt-identity58.4%

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

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

    if 2.1999999999999998e-18 < y

    1. Initial program 64.5%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.2 \cdot 10^{-18}:\\ \;\;\;\;\frac{y}{x + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]

Alternative 19: 44.0% accurate, 3.4× speedup?

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

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


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

    1. Initial program 69.7%

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

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

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

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

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

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

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

    if 8.1999999999999999e-128 < y

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 8.2 \cdot 10^{-128}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 20: 4.3% accurate, 5.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

Alternative 21: 27.0% 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 69.4%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{x}{\color{blue}{y}} \]
  8. Final simplification26.2%

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

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 2023192 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

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