Average Error: 19.7 → 0.2
Time: 5.4s
Precision: 64
\[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}\]
\[\frac{\frac{x}{x + y}}{x + y} \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{y}{\left(x + y\right) + 1}\right)\right)\]
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\frac{\frac{x}{x + y}}{x + y} \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{y}{\left(x + y\right) + 1}\right)\right)
double f(double x, double y) {
        double r541919 = x;
        double r541920 = y;
        double r541921 = r541919 * r541920;
        double r541922 = r541919 + r541920;
        double r541923 = r541922 * r541922;
        double r541924 = 1.0;
        double r541925 = r541922 + r541924;
        double r541926 = r541923 * r541925;
        double r541927 = r541921 / r541926;
        return r541927;
}

double f(double x, double y) {
        double r541928 = x;
        double r541929 = y;
        double r541930 = r541928 + r541929;
        double r541931 = r541928 / r541930;
        double r541932 = r541931 / r541930;
        double r541933 = 1.0;
        double r541934 = r541930 + r541933;
        double r541935 = r541929 / r541934;
        double r541936 = log1p(r541935);
        double r541937 = expm1(r541936);
        double r541938 = r541932 * r541937;
        return r541938;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.7
Target0.2
Herbie0.2
\[\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}\]

Derivation

  1. Initial program 19.7

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}\]
  2. Using strategy rm
  3. Applied times-frac8.2

    \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}}\]
  4. Using strategy rm
  5. Applied associate-/r*0.2

    \[\leadsto \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \cdot \frac{y}{\left(x + y\right) + 1}\]
  6. Using strategy rm
  7. Applied expm1-log1p-u0.2

    \[\leadsto \frac{\frac{x}{x + y}}{x + y} \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{y}{\left(x + y\right) + 1}\right)\right)}\]
  8. Final simplification0.2

    \[\leadsto \frac{\frac{x}{x + y}}{x + y} \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{y}{\left(x + y\right) + 1}\right)\right)\]

Reproduce

herbie shell --seed 2019362 +o rules:numerics
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (/ (/ (/ x (+ (+ y 1) x)) (+ y x)) (/ 1 (/ y (+ y x))))

  (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1))))