Average Error: 6.5 → 2.1
Time: 13.3s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[x + \frac{y - x}{\frac{t}{z}}\]
x + \frac{\left(y - x\right) \cdot z}{t}
x + \frac{y - x}{\frac{t}{z}}
double f(double x, double y, double z, double t) {
        double r426437 = x;
        double r426438 = y;
        double r426439 = r426438 - r426437;
        double r426440 = z;
        double r426441 = r426439 * r426440;
        double r426442 = t;
        double r426443 = r426441 / r426442;
        double r426444 = r426437 + r426443;
        return r426444;
}

double f(double x, double y, double z, double t) {
        double r426445 = x;
        double r426446 = y;
        double r426447 = r426446 - r426445;
        double r426448 = t;
        double r426449 = z;
        double r426450 = r426448 / r426449;
        double r426451 = r426447 / r426450;
        double r426452 = r426445 + r426451;
        return r426452;
}

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.5
Target2.1
Herbie2.1
\[\begin{array}{l} \mathbf{if}\;x \lt -9.0255111955330046 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x \lt 4.2750321637007147 \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.5

    \[x + \frac{\left(y - x\right) \cdot z}{t}\]
  2. Using strategy rm
  3. Applied associate-/l*2.1

    \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
  4. Final simplification2.1

    \[\leadsto x + \frac{y - x}{\frac{t}{z}}\]

Reproduce

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

  :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)))