Average Error: 6.1 → 2.0
Time: 3.4s
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 r646793 = x;
        double r646794 = y;
        double r646795 = r646794 - r646793;
        double r646796 = z;
        double r646797 = r646795 * r646796;
        double r646798 = t;
        double r646799 = r646797 / r646798;
        double r646800 = r646793 + r646799;
        return r646800;
}

double f(double x, double y, double z, double t) {
        double r646801 = x;
        double r646802 = y;
        double r646803 = r646802 - r646801;
        double r646804 = t;
        double r646805 = z;
        double r646806 = r646804 / r646805;
        double r646807 = r646803 / r646806;
        double r646808 = r646801 + r646807;
        return r646808;
}

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
Target2.0
Herbie2.0
\[\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.1

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

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

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

Reproduce

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