Average Error: 19.9 → 8.0
Time: 5.7s
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} \mathbf{if}\;x \leq -2.446404973366963 \cdot 10^{-156}:\\ \;\;\;\;y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_0 := \mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)\\ \frac{x}{t_0} \cdot \frac{y}{t_0} \end{array}\\ \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}
\mathbf{if}\;x \leq -2.446404973366963 \cdot 10^{-156}:\\
\;\;\;\;y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_0 := \mathsf{hypot}\left(x + y, {\left(x + y\right)}^{1.5}\right)\\
\frac{x}{t_0} \cdot \frac{y}{t_0}
\end{array}\\


\end{array}
(FPCore (x y)
 :precision binary64
 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
(FPCore (x y)
 :precision binary64
 (if (<= x -2.446404973366963e-156)
   (* y (/ x (fma (+ x y) (+ x y) (pow (+ x y) 3.0))))
   (let* ((t_0 (hypot (+ x y) (pow (+ x y) 1.5)))) (* (/ x t_0) (/ y 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 tmp;
	if (x <= -2.446404973366963e-156) {
		tmp = y * (x / fma((x + y), (x + y), pow((x + y), 3.0)));
	} else {
		double t_0 = hypot((x + y), pow((x + y), 1.5));
		tmp = (x / t_0) * (y / t_0);
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Target

Original19.9
Target0.1
Herbie8.0
\[\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \]

Derivation

  1. Split input into 2 regimes
  2. if x < -2.44640497336696324e-156

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}{y}}} \]
    4. Applied associate-/r/_binary649.1

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

    if -2.44640497336696324e-156 < x

    1. Initial program 23.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. Simplified23.0

      \[\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_binary6423.0

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

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

      \[\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 2 regimes into one program.
  4. Final simplification8.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.446404973366963 \cdot 10^{-156}:\\ \;\;\;\;y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\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 2022117 
(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))))