Average Error: 19.3 → 7.1
Time: 7.5s
Precision: binary64
\[[x, y] = \mathsf{sort}([x, y]) \\]
\[\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 := \mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)\\ t_1 := \sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}\\ \mathbf{if}\;x \leq -1.754960936749458 \cdot 10^{+112}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -5.664768576413203 \cdot 10^{-146}:\\ \;\;\;\;\frac{x}{t_1 \cdot t_1} \cdot \frac{y}{t_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{y}{t_0}}{t_0}\\ \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 (hypot (+ x y) (pow (+ x y) 1.5)))
        (t_1 (cbrt (fma (+ x y) (+ x y) (pow (+ x y) 3.0)))))
   (if (<= x -1.754960936749458e+112)
     (/ y (* x x))
     (if (<= x -5.664768576413203e-146)
       (* (/ x (* t_1 t_1)) (/ y t_1))
       (/ (* x (/ y t_0)) t_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 = hypot((x + y), pow((x + y), 1.5));
	double t_1 = cbrt(fma((x + y), (x + y), pow((x + y), 3.0)));
	double tmp;
	if (x <= -1.754960936749458e+112) {
		tmp = y / (x * x);
	} else if (x <= -5.664768576413203e-146) {
		tmp = (x / (t_1 * t_1)) * (y / t_1);
	} else {
		tmp = (x * (y / t_0)) / t_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 = hypot(Float64(x + y), (Float64(x + y) ^ 1.5))
	t_1 = cbrt(fma(Float64(x + y), Float64(x + y), (Float64(x + y) ^ 3.0)))
	tmp = 0.0
	if (x <= -1.754960936749458e+112)
		tmp = Float64(y / Float64(x * x));
	elseif (x <= -5.664768576413203e-146)
		tmp = Float64(Float64(x / Float64(t_1 * t_1)) * Float64(y / t_1));
	else
		tmp = Float64(Float64(x * Float64(y / t_0)) / t_0);
	end
	return 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[Sqrt[N[(x + y), $MachinePrecision] ^ 2 + N[Power[N[(x + y), $MachinePrecision], 1.5], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision] + N[Power[N[(x + y), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[x, -1.754960936749458e+112], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.664768576413203e-146], N[(N[(x / N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $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 := \mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)\\
t_1 := \sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}\\
\mathbf{if}\;x \leq -1.754960936749458 \cdot 10^{+112}:\\
\;\;\;\;\frac{y}{x \cdot x}\\

\mathbf{elif}\;x \leq -5.664768576413203 \cdot 10^{-146}:\\
\;\;\;\;\frac{x}{t_1 \cdot t_1} \cdot \frac{y}{t_1}\\

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


\end{array}

Error

Bits error versus x

Bits error versus y

Target

Original19.3
Target0.1
Herbie7.1
\[\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 < -1.754960936749458e112

    1. Initial program 25.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. Simplified25.5

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    3. Applied *-un-lft-identity_binary6425.5

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot \mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Applied times-frac_binary6413.5

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

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

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

    if -1.754960936749458e112 < x < -5.664768576413203e-146

    1. Initial program 10.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. Simplified10.0

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}}} \]
    4. Applied times-frac_binary644.4

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

    if -5.664768576413203e-146 < x

    1. Initial program 22.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. Simplified22.3

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \cdot \sqrt{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}}} \]
    4. Applied times-frac_binary6413.4

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

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

      \[\leadsto \frac{x}{\mathsf{hypot}\left(y + x, {\left(y + x\right)}^{1.5}\right)} \cdot \color{blue}{\frac{y}{\mathsf{hypot}\left(y + x, {\left(y + x\right)}^{1.5}\right)}} \]
    7. Applied associate-*l/_binary646.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.754960936749458 \cdot 10^{+112}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -5.664768576413203 \cdot 10^{-146}:\\ \;\;\;\;\frac{x}{\sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \cdot \frac{y}{\sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{y}{\mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)}}{\mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)}\\ \end{array} \]

Reproduce

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