Average Error: 6.4 → 1.8
Time: 12.0s
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 r8130506 = x;
        double r8130507 = y;
        double r8130508 = r8130507 - r8130506;
        double r8130509 = z;
        double r8130510 = r8130508 * r8130509;
        double r8130511 = t;
        double r8130512 = r8130510 / r8130511;
        double r8130513 = r8130506 + r8130512;
        return r8130513;
}

double f(double x, double y, double z, double t) {
        double r8130514 = x;
        double r8130515 = y;
        double r8130516 = r8130515 - r8130514;
        double r8130517 = z;
        double r8130518 = t;
        double r8130519 = r8130517 / r8130518;
        double r8130520 = r8130516 * r8130519;
        double r8130521 = r8130514 + r8130520;
        return r8130521;
}

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. Using strategy rm
  3. Applied *-un-lft-identity6.4

    \[\leadsto x + \frac{\left(y - x\right) \cdot z}{\color{blue}{1 \cdot t}}\]
  4. Applied times-frac1.8

    \[\leadsto x + \color{blue}{\frac{y - x}{1} \cdot \frac{z}{t}}\]
  5. Simplified1.8

    \[\leadsto x + \color{blue}{\left(y - x\right)} \cdot \frac{z}{t}\]
  6. 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)))