Average Error: 6.1 → 1.8
Time: 15.6s
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 r20872987 = x;
        double r20872988 = y;
        double r20872989 = r20872988 - r20872987;
        double r20872990 = z;
        double r20872991 = r20872989 * r20872990;
        double r20872992 = t;
        double r20872993 = r20872991 / r20872992;
        double r20872994 = r20872987 + r20872993;
        return r20872994;
}

double f(double x, double y, double z, double t) {
        double r20872995 = x;
        double r20872996 = y;
        double r20872997 = r20872996 - r20872995;
        double r20872998 = t;
        double r20872999 = z;
        double r20873000 = r20872998 / r20872999;
        double r20873001 = r20872997 / r20873000;
        double r20873002 = r20872995 + r20873001;
        return r20873002;
}

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.1
Target1.7
Herbie1.8
\[\begin{array}{l} \mathbf{if}\;x \lt -9.025511195533005 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x \lt 4.275032163700715 \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.1

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

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

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

Reproduce

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