Average Error: 7.6 → 0.1
Time: 5.1s
Precision: 64
\[\frac{x \cdot y}{y + 1.0}\]
\[\frac{x}{\frac{y + 1.0}{y}}\]
\frac{x \cdot y}{y + 1.0}
\frac{x}{\frac{y + 1.0}{y}}
double f(double x, double y) {
        double r33828927 = x;
        double r33828928 = y;
        double r33828929 = r33828927 * r33828928;
        double r33828930 = 1.0;
        double r33828931 = r33828928 + r33828930;
        double r33828932 = r33828929 / r33828931;
        return r33828932;
}

double f(double x, double y) {
        double r33828933 = x;
        double r33828934 = y;
        double r33828935 = 1.0;
        double r33828936 = r33828934 + r33828935;
        double r33828937 = r33828936 / r33828934;
        double r33828938 = r33828933 / r33828937;
        return r33828938;
}

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.6
Target0.0
Herbie0.1
\[\begin{array}{l} \mathbf{if}\;y \lt -3693.8482788297247:\\ \;\;\;\;\frac{x}{y \cdot y} - \left(\frac{x}{y} - x\right)\\ \mathbf{elif}\;y \lt 6799310503.41891:\\ \;\;\;\;\frac{x \cdot y}{y + 1.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y} - \left(\frac{x}{y} - x\right)\\ \end{array}\]

Derivation

  1. Initial program 7.6

    \[\frac{x \cdot y}{y + 1.0}\]
  2. Using strategy rm
  3. Applied associate-/l*0.1

    \[\leadsto \color{blue}{\frac{x}{\frac{y + 1.0}{y}}}\]
  4. Final simplification0.1

    \[\leadsto \frac{x}{\frac{y + 1.0}{y}}\]

Reproduce

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

  :herbie-target
  (if (< y -3693.8482788297247) (- (/ x (* y y)) (- (/ x y) x)) (if (< y 6799310503.41891) (/ (* x y) (+ y 1.0)) (- (/ x (* y y)) (- (/ x y) x))))

  (/ (* x y) (+ y 1.0)))