Average Error: 6.5 → 2.1
Time: 26.0s
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 r472831 = x;
        double r472832 = y;
        double r472833 = r472832 - r472831;
        double r472834 = z;
        double r472835 = r472833 * r472834;
        double r472836 = t;
        double r472837 = r472835 / r472836;
        double r472838 = r472831 + r472837;
        return r472838;
}

double f(double x, double y, double z, double t) {
        double r472839 = x;
        double r472840 = y;
        double r472841 = r472840 - r472839;
        double r472842 = t;
        double r472843 = z;
        double r472844 = r472842 / r472843;
        double r472845 = r472841 / r472844;
        double r472846 = r472839 + r472845;
        return r472846;
}

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 *-un-lft-identity6.5

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

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

    \[\leadsto x + \color{blue}{\left(y - x\right)} \cdot \frac{z}{t}\]
  6. Using strategy rm
  7. Applied associate-*r/6.5

    \[\leadsto x + \color{blue}{\frac{\left(y - x\right) \cdot z}{t}}\]
  8. Using strategy rm
  9. Applied associate-/l*2.1

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

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

Reproduce

herbie shell --seed 2020045 +o rules:numerics
(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)))