Average Error: 8.1 → 0.0
Time: 12.5s
Precision: 64
\[\frac{x \cdot y}{y + 1}\]
\[\frac{y}{y + 1} \cdot x\]
\frac{x \cdot y}{y + 1}
\frac{y}{y + 1} \cdot x
double f(double x, double y) {
        double r28266953 = x;
        double r28266954 = y;
        double r28266955 = r28266953 * r28266954;
        double r28266956 = 1.0;
        double r28266957 = r28266954 + r28266956;
        double r28266958 = r28266955 / r28266957;
        return r28266958;
}

double f(double x, double y) {
        double r28266959 = y;
        double r28266960 = 1.0;
        double r28266961 = r28266959 + r28266960;
        double r28266962 = r28266959 / r28266961;
        double r28266963 = x;
        double r28266964 = r28266962 * r28266963;
        return r28266964;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original8.1
Target0.0
Herbie0.0
\[\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 8.1

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

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

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

Reproduce

herbie shell --seed 2019172 +o rules:numerics
(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)))