Average Error: 6.7 → 1.7
Time: 17.5s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.017002593556539813041054414324238528015 \cdot 10^{-36}:\\ \;\;\;\;\frac{\frac{y - x}{t}}{\frac{1}{z}} + x\\ \mathbf{elif}\;z \le 1.565053397910881773034896102378336415142 \cdot 10^{83}:\\ \;\;\;\;\frac{\left(y - x\right) \cdot z}{t} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y - x}{t}}{\frac{1}{z}} + x\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;z \le -1.017002593556539813041054414324238528015 \cdot 10^{-36}:\\
\;\;\;\;\frac{\frac{y - x}{t}}{\frac{1}{z}} + x\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r23877995 = x;
        double r23877996 = y;
        double r23877997 = r23877996 - r23877995;
        double r23877998 = z;
        double r23877999 = r23877997 * r23877998;
        double r23878000 = t;
        double r23878001 = r23877999 / r23878000;
        double r23878002 = r23877995 + r23878001;
        return r23878002;
}

double f(double x, double y, double z, double t) {
        double r23878003 = z;
        double r23878004 = -1.0170025935565398e-36;
        bool r23878005 = r23878003 <= r23878004;
        double r23878006 = y;
        double r23878007 = x;
        double r23878008 = r23878006 - r23878007;
        double r23878009 = t;
        double r23878010 = r23878008 / r23878009;
        double r23878011 = 1.0;
        double r23878012 = r23878011 / r23878003;
        double r23878013 = r23878010 / r23878012;
        double r23878014 = r23878013 + r23878007;
        double r23878015 = 1.5650533979108818e+83;
        bool r23878016 = r23878003 <= r23878015;
        double r23878017 = r23878008 * r23878003;
        double r23878018 = r23878017 / r23878009;
        double r23878019 = r23878018 + r23878007;
        double r23878020 = r23878016 ? r23878019 : r23878014;
        double r23878021 = r23878005 ? r23878014 : r23878020;
        return r23878021;
}

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.1
Herbie1.7
\[\begin{array}{l} \mathbf{if}\;x \lt -9.025511195533004570453352523209034680317 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x \lt 4.275032163700714748507147332551979944314 \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 < -1.0170025935565398e-36 or 1.5650533979108818e+83 < z

    1. Initial program 15.8

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

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

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

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

    if -1.0170025935565398e-36 < z < 1.5650533979108818e+83

    1. Initial program 1.5

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

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

Reproduce

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