Average Error: 6.6 → 1.9
Time: 2.4s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.54168963132195903 \cdot 10^{-219}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{elif}\;x \le 2.8759426315168583 \cdot 10^{-230}:\\ \;\;\;\;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}\;x \le -4.54168963132195903 \cdot 10^{-219}:\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\

\mathbf{elif}\;x \le 2.8759426315168583 \cdot 10^{-230}:\\
\;\;\;\;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 r432038 = x;
        double r432039 = y;
        double r432040 = r432039 - r432038;
        double r432041 = z;
        double r432042 = r432040 * r432041;
        double r432043 = t;
        double r432044 = r432042 / r432043;
        double r432045 = r432038 + r432044;
        return r432045;
}

double f(double x, double y, double z, double t) {
        double r432046 = x;
        double r432047 = -4.541689631321959e-219;
        bool r432048 = r432046 <= r432047;
        double r432049 = y;
        double r432050 = r432049 - r432046;
        double r432051 = z;
        double r432052 = t;
        double r432053 = r432051 / r432052;
        double r432054 = r432050 * r432053;
        double r432055 = r432046 + r432054;
        double r432056 = 2.8759426315168583e-230;
        bool r432057 = r432046 <= r432056;
        double r432058 = r432050 / r432052;
        double r432059 = r432058 * r432051;
        double r432060 = r432046 + r432059;
        double r432061 = r432052 / r432051;
        double r432062 = r432050 / r432061;
        double r432063 = r432046 + r432062;
        double r432064 = r432057 ? r432060 : r432063;
        double r432065 = r432048 ? r432055 : r432064;
        return r432065;
}

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.6
Target1.9
Herbie1.9
\[\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 x < -4.541689631321959e-219

    1. Initial program 6.5

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

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

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

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

    if -4.541689631321959e-219 < x < 2.8759426315168583e-230

    1. Initial program 6.1

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

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

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

    if 2.8759426315168583e-230 < x

    1. Initial program 6.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.54168963132195903 \cdot 10^{-219}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{elif}\;x \le 2.8759426315168583 \cdot 10^{-230}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Reproduce

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