Average Error: 7.4 → 0.0
Time: 5.4s
Precision: 64
\[\frac{x \cdot y}{y + 1.0}\]
\[\frac{y}{y + 1.0} \cdot x\]
\frac{x \cdot y}{y + 1.0}
\frac{y}{y + 1.0} \cdot x
double f(double x, double y) {
        double r12613186 = x;
        double r12613187 = y;
        double r12613188 = r12613186 * r12613187;
        double r12613189 = 1.0;
        double r12613190 = r12613187 + r12613189;
        double r12613191 = r12613188 / r12613190;
        return r12613191;
}

double f(double x, double y) {
        double r12613192 = y;
        double r12613193 = 1.0;
        double r12613194 = r12613192 + r12613193;
        double r12613195 = r12613192 / r12613194;
        double r12613196 = x;
        double r12613197 = r12613195 * r12613196;
        return r12613197;
}

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.4
Target0.0
Herbie0.0
\[\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.4

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

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

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

    \[\leadsto \color{blue}{x} \cdot \frac{y}{y + 1.0}\]
  6. Final simplification0.0

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

Reproduce

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