Average Error: 6.1 → 1.4
Time: 16.4s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{\left(y - x\right) \cdot z}{t} = -\infty \lor \neg \left(x + \frac{\left(y - x\right) \cdot z}{t} \le 8.121194440726209424145184472892058858237 \cdot 10^{268}\right):\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;x + \frac{\left(y - x\right) \cdot z}{t} = -\infty \lor \neg \left(x + \frac{\left(y - x\right) \cdot z}{t} \le 8.121194440726209424145184472892058858237 \cdot 10^{268}\right):\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\

\mathbf{else}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r369689 = x;
        double r369690 = y;
        double r369691 = r369690 - r369689;
        double r369692 = z;
        double r369693 = r369691 * r369692;
        double r369694 = t;
        double r369695 = r369693 / r369694;
        double r369696 = r369689 + r369695;
        return r369696;
}

double f(double x, double y, double z, double t) {
        double r369697 = x;
        double r369698 = y;
        double r369699 = r369698 - r369697;
        double r369700 = z;
        double r369701 = r369699 * r369700;
        double r369702 = t;
        double r369703 = r369701 / r369702;
        double r369704 = r369697 + r369703;
        double r369705 = -inf.0;
        bool r369706 = r369704 <= r369705;
        double r369707 = 8.12119444072621e+268;
        bool r369708 = r369704 <= r369707;
        double r369709 = !r369708;
        bool r369710 = r369706 || r369709;
        double r369711 = r369699 / r369702;
        double r369712 = r369711 * r369700;
        double r369713 = r369697 + r369712;
        double r369714 = r369710 ? r369713 : r369704;
        return r369714;
}

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
Herbie1.4
\[\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 2 regimes
  2. if (+ x (/ (* (- y x) z) t)) < -inf.0 or 8.12119444072621e+268 < (+ x (/ (* (- y x) z) t))

    1. Initial program 45.7

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    4. Using strategy rm
    5. Applied associate-/r/6.5

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

    if -inf.0 < (+ x (/ (* (- y x) z) t)) < 8.12119444072621e+268

    1. Initial program 0.7

      \[x + \frac{\left(y - x\right) \cdot z}{t}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{\left(y - x\right) \cdot z}{t} = -\infty \lor \neg \left(x + \frac{\left(y - x\right) \cdot z}{t} \le 8.121194440726209424145184472892058858237 \cdot 10^{268}\right):\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \end{array}\]

Reproduce

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