Average Error: 6.5 → 1.4
Time: 13.4s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.8014498345109495 \cdot 10^{22}:\\ \;\;\;\;x + \frac{\frac{y - x}{t}}{\frac{1}{z}}\\ \mathbf{elif}\;z \le 24589954643.815292:\\ \;\;\;\;x + \left(\frac{z \cdot y}{t} - \frac{x \cdot z}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;z \le -2.8014498345109495 \cdot 10^{22}:\\
\;\;\;\;x + \frac{\frac{y - x}{t}}{\frac{1}{z}}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r387096 = x;
        double r387097 = y;
        double r387098 = r387097 - r387096;
        double r387099 = z;
        double r387100 = r387098 * r387099;
        double r387101 = t;
        double r387102 = r387100 / r387101;
        double r387103 = r387096 + r387102;
        return r387103;
}

double f(double x, double y, double z, double t) {
        double r387104 = z;
        double r387105 = -2.8014498345109495e+22;
        bool r387106 = r387104 <= r387105;
        double r387107 = x;
        double r387108 = y;
        double r387109 = r387108 - r387107;
        double r387110 = t;
        double r387111 = r387109 / r387110;
        double r387112 = 1.0;
        double r387113 = r387112 / r387104;
        double r387114 = r387111 / r387113;
        double r387115 = r387107 + r387114;
        double r387116 = 24589954643.815292;
        bool r387117 = r387104 <= r387116;
        double r387118 = r387104 * r387108;
        double r387119 = r387118 / r387110;
        double r387120 = r387107 * r387104;
        double r387121 = r387120 / r387110;
        double r387122 = r387119 - r387121;
        double r387123 = r387107 + r387122;
        double r387124 = r387111 * r387104;
        double r387125 = r387107 + r387124;
        double r387126 = r387117 ? r387123 : r387125;
        double r387127 = r387106 ? r387115 : r387126;
        return r387127;
}

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.0
Herbie1.4
\[\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 < -2.8014498345109495e+22

    1. Initial program 16.3

      \[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 div-inv3.6

      \[\leadsto x + \frac{y - x}{\color{blue}{t \cdot \frac{1}{z}}}\]
    6. Applied associate-/r*2.0

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

    if -2.8014498345109495e+22 < z < 24589954643.815292

    1. Initial program 1.2

      \[x + \frac{\left(y - x\right) \cdot z}{t}\]
    2. Taylor expanded around 0 1.2

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

    if 24589954643.815292 < z

    1. Initial program 16.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.8014498345109495 \cdot 10^{22}:\\ \;\;\;\;x + \frac{\frac{y - x}{t}}{\frac{1}{z}}\\ \mathbf{elif}\;z \le 24589954643.815292:\\ \;\;\;\;x + \left(\frac{z \cdot y}{t} - \frac{x \cdot z}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \end{array}\]

Reproduce

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

  :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)))