Average Error: 19.6 → 7.0
Time: 8.4s
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 := \sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}\\ t_1 := \mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)\\ \mathbf{if}\;x \leq -4.9961300774504924 \cdot 10^{+103}:\\ \;\;\;\;\frac{y}{{x}^{2}}\\ \mathbf{elif}\;x \leq -2.1861370762499374 \cdot 10^{-147}:\\ \;\;\;\;\frac{1}{t_0} \cdot \left(\frac{x}{t_0} \cdot \frac{y}{t_0}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t_1} \cdot \frac{y}{t_1}\\ \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 (cbrt (fma (+ x y) (+ x y) (pow (+ x y) 3.0))))
        (t_1 (hypot (+ x y) (pow (+ x y) 1.5))))
   (if (<= x -4.9961300774504924e+103)
     (/ y (pow x 2.0))
     (if (<= x -2.1861370762499374e-147)
       (* (/ 1.0 t_0) (* (/ x t_0) (/ y t_0)))
       (* (/ x t_1) (/ y t_1))))))
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 = cbrt(fma((x + y), (x + y), pow((x + y), 3.0)));
	double t_1 = hypot((x + y), pow((x + y), 1.5));
	double tmp;
	if (x <= -4.9961300774504924e+103) {
		tmp = y / pow(x, 2.0);
	} else if (x <= -2.1861370762499374e-147) {
		tmp = (1.0 / t_0) * ((x / t_0) * (y / t_0));
	} else {
		tmp = (x / t_1) * (y / t_1);
	}
	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 = cbrt(fma(Float64(x + y), Float64(x + y), (Float64(x + y) ^ 3.0)))
	t_1 = hypot(Float64(x + y), (Float64(x + y) ^ 1.5))
	tmp = 0.0
	if (x <= -4.9961300774504924e+103)
		tmp = Float64(y / (x ^ 2.0));
	elseif (x <= -2.1861370762499374e-147)
		tmp = Float64(Float64(1.0 / t_0) * Float64(Float64(x / t_0) * Float64(y / t_0)));
	else
		tmp = Float64(Float64(x / t_1) * Float64(y / t_1));
	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[Power[N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision] + N[Power[N[(x + y), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(x + y), $MachinePrecision] ^ 2 + N[Power[N[(x + y), $MachinePrecision], 1.5], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[x, -4.9961300774504924e+103], N[(y / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.1861370762499374e-147], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[(x / t$95$0), $MachinePrecision] * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / t$95$1), $MachinePrecision] * N[(y / t$95$1), $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 := \sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}\\
t_1 := \mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)\\
\mathbf{if}\;x \leq -4.9961300774504924 \cdot 10^{+103}:\\
\;\;\;\;\frac{y}{{x}^{2}}\\

\mathbf{elif}\;x \leq -2.1861370762499374 \cdot 10^{-147}:\\
\;\;\;\;\frac{1}{t_0} \cdot \left(\frac{x}{t_0} \cdot \frac{y}{t_0}\right)\\

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


\end{array}

Error

Bits error versus x

Bits error versus y

Target

Original19.6
Target0.1
Herbie7.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 < -4.99613007745049241e103

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

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

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

    if -4.99613007745049241e103 < x < -2.1861370762499374e-147

    1. Initial program 9.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. Simplified9.6

      \[\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.1

      \[\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.1

      \[\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)}}} \]
    5. Applied *-un-lft-identity_binary644.1

      \[\leadsto \frac{\color{blue}{1 \cdot 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)}} \]
    6. Applied times-frac_binary644.1

      \[\leadsto \color{blue}{\left(\frac{1}{\sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \cdot \frac{x}{\sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}}\right)} \cdot \frac{y}{\sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    7. Applied associate-*l*_binary644.1

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \cdot \left(\frac{x}{\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)}}\right)} \]

    if -2.1861370762499374e-147 < x

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

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

      \[\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_binary6414.5

      \[\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. Simplified15.1

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

      \[\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)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification7.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.9961300774504924 \cdot 10^{+103}:\\ \;\;\;\;\frac{y}{{x}^{2}}\\ \mathbf{elif}\;x \leq -2.1861370762499374 \cdot 10^{-147}:\\ \;\;\;\;\frac{1}{\sqrt[3]{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \cdot \left(\frac{x}{\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)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)} \cdot \frac{y}{\mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)}\\ \end{array} \]

Reproduce

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