Average Error: 6.4 → 1.8
Time: 16.2s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
x + \frac{\left(y - x\right) \cdot z}{t}
x + \left(y - x\right) \cdot \frac{z}{t}
double f(double x, double y, double z, double t) {
        double r28819623 = x;
        double r28819624 = y;
        double r28819625 = r28819624 - r28819623;
        double r28819626 = z;
        double r28819627 = r28819625 * r28819626;
        double r28819628 = t;
        double r28819629 = r28819627 / r28819628;
        double r28819630 = r28819623 + r28819629;
        return r28819630;
}

double f(double x, double y, double z, double t) {
        double r28819631 = x;
        double r28819632 = y;
        double r28819633 = r28819632 - r28819631;
        double r28819634 = z;
        double r28819635 = t;
        double r28819636 = r28819634 / r28819635;
        double r28819637 = r28819633 * r28819636;
        double r28819638 = r28819631 + r28819637;
        return r28819638;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.4
Target2.0
Herbie1.8
\[\begin{array}{l} \mathbf{if}\;x \lt -9.025511195533004570453352523209034680317 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x \lt 4.275032163700714748507147332551979944314 \cdot 10^{-250}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Derivation

  1. Initial program 6.4

    \[x + \frac{\left(y - x\right) \cdot z}{t}\]
  2. Taylor expanded around 0 6.4

    \[\leadsto \color{blue}{\left(\frac{z \cdot y}{t} + x\right) - \frac{x \cdot z}{t}}\]
  3. Simplified1.7

    \[\leadsto \color{blue}{\frac{y - x}{\frac{t}{z}} + x}\]
  4. Using strategy rm
  5. Applied div-inv1.9

    \[\leadsto \color{blue}{\left(y - x\right) \cdot \frac{1}{\frac{t}{z}}} + x\]
  6. Simplified1.8

    \[\leadsto \left(y - x\right) \cdot \color{blue}{\frac{z}{t}} + x\]
  7. Final simplification1.8

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

Reproduce

herbie shell --seed 2019171 
(FPCore (x y z t)
  :name "Numeric.Histogram:binBounds from Chart-1.5.3"

  :herbie-target
  (if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))

  (+ x (/ (* (- y x) z) t)))