Average Error: 6.4 → 1.6
Time: 3.7s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -7.42763758103976 \cdot 10^{67} \lor \neg \left(z \le 2.3482764413141227 \cdot 10^{-34}\right):\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{t} \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;z \le -7.42763758103976 \cdot 10^{67} \lor \neg \left(z \le 2.3482764413141227 \cdot 10^{-34}\right):\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r439897 = x;
        double r439898 = y;
        double r439899 = r439898 - r439897;
        double r439900 = z;
        double r439901 = r439899 * r439900;
        double r439902 = t;
        double r439903 = r439901 / r439902;
        double r439904 = r439897 + r439903;
        return r439904;
}

double f(double x, double y, double z, double t) {
        double r439905 = z;
        double r439906 = -7.42763758103976e+67;
        bool r439907 = r439905 <= r439906;
        double r439908 = 2.3482764413141227e-34;
        bool r439909 = r439905 <= r439908;
        double r439910 = !r439909;
        bool r439911 = r439907 || r439910;
        double r439912 = x;
        double r439913 = y;
        double r439914 = r439913 - r439912;
        double r439915 = t;
        double r439916 = r439914 / r439915;
        double r439917 = r439916 * r439905;
        double r439918 = r439912 + r439917;
        double r439919 = 1.0;
        double r439920 = r439919 / r439915;
        double r439921 = r439914 * r439905;
        double r439922 = r439920 * r439921;
        double r439923 = r439912 + r439922;
        double r439924 = r439911 ? r439918 : r439923;
        return r439924;
}

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.4
Target2.1
Herbie1.6
\[\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 z < -7.42763758103976e+67 or 2.3482764413141227e-34 < z

    1. Initial program 15.9

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

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

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

    if -7.42763758103976e+67 < z < 2.3482764413141227e-34

    1. Initial program 1.4

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    4. Using strategy rm
    5. Applied div-inv1.0

      \[\leadsto x + \frac{y - x}{\color{blue}{t \cdot \frac{1}{z}}}\]
    6. Applied *-un-lft-identity1.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -7.42763758103976 \cdot 10^{67} \lor \neg \left(z \le 2.3482764413141227 \cdot 10^{-34}\right):\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{t} \cdot \left(\left(y - x\right) \cdot z\right)\\ \end{array}\]

Reproduce

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