Average Error: 6.6 → 1.9
Time: 6.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 r371574 = x;
        double r371575 = y;
        double r371576 = r371575 - r371574;
        double r371577 = z;
        double r371578 = r371576 * r371577;
        double r371579 = t;
        double r371580 = r371578 / r371579;
        double r371581 = r371574 + r371580;
        return r371581;
}

double f(double x, double y, double z, double t) {
        double r371582 = x;
        double r371583 = y;
        double r371584 = r371583 - r371582;
        double r371585 = t;
        double r371586 = z;
        double r371587 = r371585 / r371586;
        double r371588 = r371584 / r371587;
        double r371589 = r371582 + r371588;
        return r371589;
}

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.6
Target2.1
Herbie1.9
\[\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. Split input into 3 regimes
  2. if t < -3.542613364473471e-276

    1. Initial program 6.7

      \[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. Using strategy rm
    5. Applied clear-num1.8

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

    if -3.542613364473471e-276 < t < 4.428168098827568e+65

    1. Initial program 2.2

      \[x + \frac{\left(y - x\right) \cdot z}{t}\]

    if 4.428168098827568e+65 < t

    1. Initial program 10.9

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.9

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

Reproduce

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

  :herbie-target
  (if (< x -9.0255111955330046e-135) (- x (* (/ z t) (- x y))) (if (< x 4.2750321637007147e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))

  (+ x (/ (* (- y x) z) t)))