Average Error: 20.0 → 0.1
Time: 8.8s
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)}\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) + 1}}{y + x}\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)}
\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) + 1}}{y + x}\right)\right)
double f(double x, double y) {
        double r518325 = x;
        double r518326 = y;
        double r518327 = r518325 * r518326;
        double r518328 = r518325 + r518326;
        double r518329 = r518328 * r518328;
        double r518330 = 1.0;
        double r518331 = r518328 + r518330;
        double r518332 = r518329 * r518331;
        double r518333 = r518327 / r518332;
        return r518333;
}

double f(double x, double y) {
        double r518334 = x;
        double r518335 = y;
        double r518336 = r518334 + r518335;
        double r518337 = r518334 / r518336;
        double r518338 = 1.0;
        double r518339 = r518336 + r518338;
        double r518340 = r518335 / r518339;
        double r518341 = r518337 * r518340;
        double r518342 = r518335 + r518334;
        double r518343 = r518341 / r518342;
        double r518344 = log1p(r518343);
        double r518345 = expm1(r518344);
        return r518345;
}

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.0
Target0.1
Herbie0.1
\[\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}\]

Derivation

  1. Initial program 20.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. 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 *-un-lft-identity8.2

    \[\leadsto \frac{\color{blue}{1 \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}\]
  6. Applied times-frac0.2

    \[\leadsto \color{blue}{\left(\frac{1}{x + y} \cdot \frac{x}{x + y}\right)} \cdot \frac{y}{\left(x + y\right) + 1}\]
  7. Applied associate-*l*0.2

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

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{x + y} \cdot \left(\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) + 1}\right)\right)\right)}\]
  10. Simplified0.1

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

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

Reproduce

herbie shell --seed 2020046 +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))))