Average Error: 6.5 → 2.0
Time: 4.0s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le 8.72237655502040412 \cdot 10^{-83}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{elif}\;z \le 2.11625050668119009 \cdot 10^{206}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;z \le 8.72237655502040412 \cdot 10^{-83}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\

\mathbf{elif}\;z \le 2.11625050668119009 \cdot 10^{206}:\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r499656 = x;
        double r499657 = y;
        double r499658 = r499657 - r499656;
        double r499659 = z;
        double r499660 = r499658 * r499659;
        double r499661 = t;
        double r499662 = r499660 / r499661;
        double r499663 = r499656 + r499662;
        return r499663;
}

double f(double x, double y, double z, double t) {
        double r499664 = z;
        double r499665 = 8.722376555020404e-83;
        bool r499666 = r499664 <= r499665;
        double r499667 = x;
        double r499668 = y;
        double r499669 = r499668 - r499667;
        double r499670 = t;
        double r499671 = r499664 / r499670;
        double r499672 = r499669 * r499671;
        double r499673 = r499667 + r499672;
        double r499674 = 2.11625050668119e+206;
        bool r499675 = r499664 <= r499674;
        double r499676 = r499669 / r499670;
        double r499677 = r499676 * r499664;
        double r499678 = r499667 + r499677;
        double r499679 = r499670 / r499664;
        double r499680 = r499669 / r499679;
        double r499681 = r499667 + r499680;
        double r499682 = r499675 ? r499678 : r499681;
        double r499683 = r499666 ? r499673 : r499682;
        return r499683;
}

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.2
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. Split input into 3 regimes
  2. if z < 8.722376555020404e-83

    1. Initial program 5.0

      \[x + \frac{\left(y - x\right) \cdot z}{t}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity5.0

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

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

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

    if 8.722376555020404e-83 < z < 2.11625050668119e+206

    1. Initial program 7.7

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

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

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

    if 2.11625050668119e+206 < z

    1. Initial program 25.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le 8.72237655502040412 \cdot 10^{-83}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{elif}\;z \le 2.11625050668119009 \cdot 10^{206}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Reproduce

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