Average Error: 20.3 → 2.0
Time: 4.2s
Precision: binary64
\[ \begin{array}{c}[x, y] = \mathsf{sort}([x, y])\\ \end{array} \]
\[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
\[\begin{array}{l} t_0 := \frac{x}{x + y}\\ \mathbf{if}\;x \leq -2.4 \cdot 10^{+160}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{+94}:\\ \;\;\;\;\frac{y \cdot t_0}{y + \left(x + {\left(x + y\right)}^{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot {\left(\frac{\sqrt{y}}{\mathsf{hypot}\left(\sqrt{x + y}, x + y\right)}\right)}^{2}\\ \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ x (+ x y))))
   (if (<= x -2.4e+160)
     (/ (/ y x) x)
     (if (<= x 6.4e+94)
       (/ (* y t_0) (+ y (+ x (pow (+ x y) 2.0))))
       (* t_0 (pow (/ (sqrt y) (hypot (sqrt (+ x y)) (+ x y))) 2.0))))))
double code(double x, double y) {
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
double code(double x, double y) {
	double t_0 = x / (x + y);
	double tmp;
	if (x <= -2.4e+160) {
		tmp = (y / x) / x;
	} else if (x <= 6.4e+94) {
		tmp = (y * t_0) / (y + (x + pow((x + y), 2.0)));
	} else {
		tmp = t_0 * pow((sqrt(y) / hypot(sqrt((x + y)), (x + y))), 2.0);
	}
	return tmp;
}
public static double code(double x, double y) {
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
public static double code(double x, double y) {
	double t_0 = x / (x + y);
	double tmp;
	if (x <= -2.4e+160) {
		tmp = (y / x) / x;
	} else if (x <= 6.4e+94) {
		tmp = (y * t_0) / (y + (x + Math.pow((x + y), 2.0)));
	} else {
		tmp = t_0 * Math.pow((Math.sqrt(y) / Math.hypot(Math.sqrt((x + y)), (x + y))), 2.0);
	}
	return tmp;
}
def code(x, y):
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
def code(x, y):
	t_0 = x / (x + y)
	tmp = 0
	if x <= -2.4e+160:
		tmp = (y / x) / x
	elif x <= 6.4e+94:
		tmp = (y * t_0) / (y + (x + math.pow((x + y), 2.0)))
	else:
		tmp = t_0 * math.pow((math.sqrt(y) / math.hypot(math.sqrt((x + y)), (x + y))), 2.0)
	return tmp
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 code(x, y)
	t_0 = Float64(x / Float64(x + y))
	tmp = 0.0
	if (x <= -2.4e+160)
		tmp = Float64(Float64(y / x) / x);
	elseif (x <= 6.4e+94)
		tmp = Float64(Float64(y * t_0) / Float64(y + Float64(x + (Float64(x + y) ^ 2.0))));
	else
		tmp = Float64(t_0 * (Float64(sqrt(y) / hypot(sqrt(Float64(x + y)), Float64(x + y))) ^ 2.0));
	end
	return tmp
end
function tmp = code(x, y)
	tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
end
function tmp_2 = code(x, y)
	t_0 = x / (x + y);
	tmp = 0.0;
	if (x <= -2.4e+160)
		tmp = (y / x) / x;
	elseif (x <= 6.4e+94)
		tmp = (y * t_0) / (y + (x + ((x + y) ^ 2.0)));
	else
		tmp = t_0 * ((sqrt(y) / hypot(sqrt((x + y)), (x + y))) ^ 2.0);
	end
	tmp_2 = tmp;
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]
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.4e+160], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 6.4e+94], N[(N[(y * t$95$0), $MachinePrecision] / N[(y + N[(x + N[Power[N[(x + y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Power[N[(N[Sqrt[y], $MachinePrecision] / N[Sqrt[N[Sqrt[N[(x + y), $MachinePrecision]], $MachinePrecision] ^ 2 + N[(x + y), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
\mathbf{if}\;x \leq -2.4 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\

\mathbf{elif}\;x \leq 6.4 \cdot 10^{+94}:\\
\;\;\;\;\frac{y \cdot t_0}{y + \left(x + {\left(x + y\right)}^{2}\right)}\\

\mathbf{else}:\\
\;\;\;\;t_0 \cdot {\left(\frac{\sqrt{y}}{\mathsf{hypot}\left(\sqrt{x + y}, x + y\right)}\right)}^{2}\\


\end{array}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original20.3
Target0.1
Herbie2.0
\[\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \]

Derivation

  1. Split input into 3 regimes
  2. if x < -2.4000000000000001e160

    1. Initial program 24.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. Simplified11.1

      \[\leadsto \color{blue}{\frac{x}{\frac{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}{y}}} \]
    3. Applied egg-rr11.1

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

      \[\leadsto \color{blue}{\frac{y}{{x}^{2}}} \]
    5. Simplified4.6

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

    if -2.4000000000000001e160 < x < 6.40000000000000028e94

    1. Initial program 17.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. Simplified11.7

      \[\leadsto \color{blue}{\frac{x}{\frac{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}{y}}} \]
    3. Applied egg-rr11.7

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

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

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

    if 6.40000000000000028e94 < x

    1. Initial program 63.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. Simplified33.0

      \[\leadsto \color{blue}{\frac{x}{\frac{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}{y}}} \]
    3. Applied egg-rr33.0

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

      \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{x + \left(y + {\left(x + y\right)}^{2}\right)}} \]
    5. Applied egg-rr0.4

      \[\leadsto \frac{x}{x + y} \cdot \color{blue}{{\left(\frac{\sqrt{y}}{\mathsf{hypot}\left(\sqrt{y + x}, y + x\right)}\right)}^{2}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification2.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{+160}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{+94}:\\ \;\;\;\;\frac{y \cdot \frac{x}{x + y}}{y + \left(x + {\left(x + y\right)}^{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + y} \cdot {\left(\frac{\sqrt{y}}{\mathsf{hypot}\left(\sqrt{x + y}, x + y\right)}\right)}^{2}\\ \end{array} \]

Reproduce

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