Average Error: 6.7 → 1.0
Time: 10.7s
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 7.47453856091499786 \cdot 10^{296}\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 7.47453856091499786 \cdot 10^{296}\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 r553648 = x;
        double r553649 = y;
        double r553650 = r553649 - r553648;
        double r553651 = z;
        double r553652 = r553650 * r553651;
        double r553653 = t;
        double r553654 = r553652 / r553653;
        double r553655 = r553648 + r553654;
        return r553655;
}

double f(double x, double y, double z, double t) {
        double r553656 = x;
        double r553657 = y;
        double r553658 = r553657 - r553656;
        double r553659 = z;
        double r553660 = r553658 * r553659;
        double r553661 = t;
        double r553662 = r553660 / r553661;
        double r553663 = r553656 + r553662;
        double r553664 = -inf.0;
        bool r553665 = r553663 <= r553664;
        double r553666 = 7.474538560914998e+296;
        bool r553667 = r553663 <= r553666;
        double r553668 = !r553667;
        bool r553669 = r553665 || r553668;
        double r553670 = r553658 / r553661;
        double r553671 = r553670 * r553659;
        double r553672 = r553656 + r553671;
        double r553673 = r553669 ? r553672 : r553663;
        return r553673;
}

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.7
Target2.3
Herbie1.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. Split input into 2 regimes
  2. if (+ x (/ (* (- y x) z) t)) < -inf.0 or 7.474538560914998e+296 < (+ x (/ (* (- y x) z) t))

    1. Initial program 58.1

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

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

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

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

    1. Initial program 0.8

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

    \[\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 7.47453856091499786 \cdot 10^{296}\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 2020042 
(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)))