Average Error: 7.8 → 0.0
Time: 23.6s
Precision: 64
\[\frac{x \cdot y}{y + 1}\]
\[\frac{y - 1}{y + 1} \cdot \left(\frac{y}{y - 1} \cdot x\right)\]
\frac{x \cdot y}{y + 1}
\frac{y - 1}{y + 1} \cdot \left(\frac{y}{y - 1} \cdot x\right)
double f(double x, double y) {
        double r33944369 = x;
        double r33944370 = y;
        double r33944371 = r33944369 * r33944370;
        double r33944372 = 1.0;
        double r33944373 = r33944370 + r33944372;
        double r33944374 = r33944371 / r33944373;
        return r33944374;
}

double f(double x, double y) {
        double r33944375 = y;
        double r33944376 = 1.0;
        double r33944377 = r33944375 - r33944376;
        double r33944378 = r33944375 + r33944376;
        double r33944379 = r33944377 / r33944378;
        double r33944380 = r33944375 / r33944377;
        double r33944381 = x;
        double r33944382 = r33944380 * r33944381;
        double r33944383 = r33944379 * r33944382;
        return r33944383;
}

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.8
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 7.8

    \[\frac{x \cdot y}{y + 1}\]
  2. Using strategy rm
  3. Applied flip-+17.4

    \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{y \cdot y - 1 \cdot 1}{y - 1}}}\]
  4. Applied associate-/r/19.2

    \[\leadsto \color{blue}{\frac{x \cdot y}{y \cdot y - 1 \cdot 1} \cdot \left(y - 1\right)}\]
  5. Simplified7.3

    \[\leadsto \color{blue}{\frac{x \cdot \frac{y}{y - 1}}{y + 1}} \cdot \left(y - 1\right)\]
  6. Using strategy rm
  7. Applied div-inv7.3

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

    \[\leadsto \color{blue}{\left(x \cdot \frac{y}{y - 1}\right) \cdot \left(\frac{1}{y + 1} \cdot \left(y - 1\right)\right)}\]
  9. Simplified0.0

    \[\leadsto \left(x \cdot \frac{y}{y - 1}\right) \cdot \color{blue}{\frac{y - 1}{1 + y}}\]
  10. Final simplification0.0

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

Reproduce

herbie shell --seed 2019168 
(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)))