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

Percentage Accurate: 69.1% → 99.8%
Time: 21.6s
Alternatives: 19
Speedup: 1.3×

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 19 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.1% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

Alternative 2: 80.1% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq -6 \cdot 10^{-169}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 3: 85.5% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq -6 \cdot 10^{-169}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 4: 94.4% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 5: 97.2% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 6: 79.8% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 7: 92.9% accurate, 1.0× speedup?

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 8: 99.8% accurate, 1.0× speedup?

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

Alternative 9: 80.8% accurate, 1.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{if}\;y \leq 7 \cdot 10^{-214}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-199}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-117}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+159}:\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{1}{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 (/ y (* x (+ x 1.0)))))
   (if (<= y 7e-214)
     t_0
     (if (<= y 1.45e-199)
       (/ x y)
       (if (<= y 3.8e-117)
         t_0
         (if (<= y 1.6e+159) (/ x (+ y (* y y))) (/ (* x (/ 1.0 y)) y)))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (y <= 7e-214) {
		tmp = t_0;
	} else if (y <= 1.45e-199) {
		tmp = x / y;
	} else if (y <= 3.8e-117) {
		tmp = t_0;
	} else if (y <= 1.6e+159) {
		tmp = x / (y + (y * y));
	} else {
		tmp = (x * (1.0 / 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 = y / (x * (x + 1.0d0))
    if (y <= 7d-214) then
        tmp = t_0
    else if (y <= 1.45d-199) then
        tmp = x / y
    else if (y <= 3.8d-117) then
        tmp = t_0
    else if (y <= 1.6d+159) then
        tmp = x / (y + (y * y))
    else
        tmp = (x * (1.0d0 / y)) / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (y <= 7e-214) {
		tmp = t_0;
	} else if (y <= 1.45e-199) {
		tmp = x / y;
	} else if (y <= 3.8e-117) {
		tmp = t_0;
	} else if (y <= 1.6e+159) {
		tmp = x / (y + (y * y));
	} else {
		tmp = (x * (1.0 / y)) / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * (x + 1.0))
	tmp = 0
	if y <= 7e-214:
		tmp = t_0
	elif y <= 1.45e-199:
		tmp = x / y
	elif y <= 3.8e-117:
		tmp = t_0
	elif y <= 1.6e+159:
		tmp = x / (y + (y * y))
	else:
		tmp = (x * (1.0 / y)) / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x * Float64(x + 1.0)))
	tmp = 0.0
	if (y <= 7e-214)
		tmp = t_0;
	elseif (y <= 1.45e-199)
		tmp = Float64(x / y);
	elseif (y <= 3.8e-117)
		tmp = t_0;
	elseif (y <= 1.6e+159)
		tmp = Float64(x / Float64(y + Float64(y * y)));
	else
		tmp = Float64(Float64(x * Float64(1.0 / y)) / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x * (x + 1.0));
	tmp = 0.0;
	if (y <= 7e-214)
		tmp = t_0;
	elseif (y <= 1.45e-199)
		tmp = x / y;
	elseif (y <= 3.8e-117)
		tmp = t_0;
	elseif (y <= 1.6e+159)
		tmp = x / (y + (y * y));
	else
		tmp = (x * (1.0 / 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[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 7e-214], t$95$0, If[LessEqual[y, 1.45e-199], N[(x / y), $MachinePrecision], If[LessEqual[y, 3.8e-117], t$95$0, If[LessEqual[y, 1.6e+159], N[(x / N[(y + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(1.0 / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;y \leq 7 \cdot 10^{-214}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 1.45 \cdot 10^{-199}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;y \leq 3.8 \cdot 10^{-117}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 1.6 \cdot 10^{+159}:\\
\;\;\;\;\frac{x}{y + y \cdot y}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 10: 81.0% accurate, 1.1× speedup?

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

\mathbf{elif}\;y \leq 1.45 \cdot 10^{-199}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;y \leq 3.8 \cdot 10^{-117}:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 11: 82.4% accurate, 1.1× speedup?

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

\mathbf{elif}\;y \leq 1.45 \cdot 10^{-199}:\\
\;\;\;\;\frac{x}{y}\\

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 12: 79.8% accurate, 1.1× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 13: 76.4% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{if}\;x \leq -1.95 \cdot 10^{-9}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -6.1 \cdot 10^{-99}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{-169}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + 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
 (let* ((t_0 (/ y (* x (+ x 1.0)))))
   (if (<= x -1.95e-9)
     t_0
     (if (<= x -6.1e-99)
       (/ x (* y (+ y 1.0)))
       (if (<= x -6e-169) t_0 (/ x (+ y (* y y))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -1.95e-9) {
		tmp = t_0;
	} else if (x <= -6.1e-99) {
		tmp = x / (y * (y + 1.0));
	} else if (x <= -6e-169) {
		tmp = t_0;
	} else {
		tmp = x / (y + (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 = y / (x * (x + 1.0d0))
    if (x <= (-1.95d-9)) then
        tmp = t_0
    else if (x <= (-6.1d-99)) then
        tmp = x / (y * (y + 1.0d0))
    else if (x <= (-6d-169)) then
        tmp = t_0
    else
        tmp = x / (y + (y * y))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -1.95e-9) {
		tmp = t_0;
	} else if (x <= -6.1e-99) {
		tmp = x / (y * (y + 1.0));
	} else if (x <= -6e-169) {
		tmp = t_0;
	} else {
		tmp = x / (y + (y * y));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * (x + 1.0))
	tmp = 0
	if x <= -1.95e-9:
		tmp = t_0
	elif x <= -6.1e-99:
		tmp = x / (y * (y + 1.0))
	elif x <= -6e-169:
		tmp = t_0
	else:
		tmp = x / (y + (y * y))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x * Float64(x + 1.0)))
	tmp = 0.0
	if (x <= -1.95e-9)
		tmp = t_0;
	elseif (x <= -6.1e-99)
		tmp = Float64(x / Float64(y * Float64(y + 1.0)));
	elseif (x <= -6e-169)
		tmp = t_0;
	else
		tmp = Float64(x / Float64(y + Float64(y * y)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x * (x + 1.0));
	tmp = 0.0;
	if (x <= -1.95e-9)
		tmp = t_0;
	elseif (x <= -6.1e-99)
		tmp = x / (y * (y + 1.0));
	elseif (x <= -6e-169)
		tmp = t_0;
	else
		tmp = x / (y + (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[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.95e-9], t$95$0, If[LessEqual[x, -6.1e-99], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6e-169], t$95$0, N[(x / N[(y + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{-9}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;x \leq -6 \cdot 10^{-169}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 14: 80.9% accurate, 1.3× speedup?

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

\mathbf{elif}\;y \leq 1.45 \cdot 10^{-199}:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;y \leq 3.8 \cdot 10^{-117}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 15: 79.6% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 16: 79.7% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 17: 48.8% accurate, 2.4× speedup?

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

Alternative 18: 48.8% accurate, 2.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{y + y \cdot y} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ x (+ y (* y y))))
assert(x < y);
double code(double x, double y) {
	return x / (y + (y * 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 + (y * y))
end function
assert x < y;
public static double code(double x, double y) {
	return x / (y + (y * y));
}
[x, y] = sort([x, y])
def code(x, y):
	return x / (y + (y * y))
x, y = sort([x, y])
function code(x, y)
	return Float64(x / Float64(y + Float64(y * y)))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = x / (y + (y * y));
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(x / N[(y + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y + y \cdot y}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 19: 26.5% accurate, 5.7× speedup?

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

Developer target: 99.8% accurate, 0.9× speedup?

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

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

Reproduce

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