Average Error: 7.9 → 7.9
Time: 9.1s
Precision: 64
\[\frac{x \cdot y}{y + 1}\]
\[\frac{x \cdot y}{y + 1}\]
\frac{x \cdot y}{y + 1}
\frac{x \cdot y}{y + 1}
double f(double x, double y) {
        double r457378 = x;
        double r457379 = y;
        double r457380 = r457378 * r457379;
        double r457381 = 1.0;
        double r457382 = r457379 + r457381;
        double r457383 = r457380 / r457382;
        return r457383;
}

double f(double x, double y) {
        double r457384 = x;
        double r457385 = y;
        double r457386 = r457384 * r457385;
        double r457387 = 1.0;
        double r457388 = r457385 + r457387;
        double r457389 = r457386 / r457388;
        return r457389;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.9
Target0.0
Herbie7.9
\[\begin{array}{l} \mathbf{if}\;y \lt -3693.848278829724677052581682801246643066:\\ \;\;\;\;\frac{x}{y \cdot y} - \left(\frac{x}{y} - x\right)\\ \mathbf{elif}\;y \lt 6799310503.41891002655029296875:\\ \;\;\;\;\frac{x \cdot y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y} - \left(\frac{x}{y} - x\right)\\ \end{array}\]

Derivation

  1. Initial program 7.9

    \[\frac{x \cdot y}{y + 1}\]
  2. Using strategy rm
  3. Applied *-un-lft-identity7.9

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

    \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{y + 1}}\]
  5. Simplified0.0

    \[\leadsto \color{blue}{x} \cdot \frac{y}{y + 1}\]
  6. Using strategy rm
  7. Applied clear-num0.1

    \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{y + 1}{y}}}\]
  8. Using strategy rm
  9. Applied div-inv0.2

    \[\leadsto x \cdot \frac{1}{\color{blue}{\left(y + 1\right) \cdot \frac{1}{y}}}\]
  10. Applied associate-/r*0.1

    \[\leadsto x \cdot \color{blue}{\frac{\frac{1}{y + 1}}{\frac{1}{y}}}\]
  11. Final simplification7.9

    \[\leadsto \frac{x \cdot y}{y + 1}\]

Reproduce

herbie shell --seed 2019291 
(FPCore (x y)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, B"
  :precision binary64

  :herbie-target
  (if (< y -3693.84827882972468) (- (/ x (* y y)) (- (/ x y) x)) (if (< y 6799310503.41891003) (/ (* x y) (+ y 1)) (- (/ x (* y y)) (- (/ x y) x))))

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