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

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r33279165 = x;
        double r33279166 = y;
        double r33279167 = r33279166 - r33279165;
        double r33279168 = z;
        double r33279169 = r33279167 * r33279168;
        double r33279170 = t;
        double r33279171 = r33279169 / r33279170;
        double r33279172 = r33279165 + r33279171;
        return r33279172;
}

double f(double x, double y, double z, double t) {
        double r33279173 = z;
        double r33279174 = -1.0170025935565398e-36;
        bool r33279175 = r33279173 <= r33279174;
        double r33279176 = x;
        double r33279177 = y;
        double r33279178 = r33279177 - r33279176;
        double r33279179 = t;
        double r33279180 = r33279178 / r33279179;
        double r33279181 = 1.0;
        double r33279182 = r33279181 / r33279173;
        double r33279183 = r33279180 / r33279182;
        double r33279184 = r33279176 + r33279183;
        double r33279185 = 1.5650533979108818e+83;
        bool r33279186 = r33279173 <= r33279185;
        double r33279187 = r33279178 * r33279173;
        double r33279188 = r33279187 / r33279179;
        double r33279189 = r33279176 + r33279188;
        double r33279190 = r33279186 ? r33279189 : r33279184;
        double r33279191 = r33279175 ? r33279184 : r33279190;
        return r33279191;
}

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}:\\ \;\;\;\;x + \frac{\frac{y - x}{t}}{\frac{1}{z}}\\ \mathbf{elif}\;z \le 1.565053397910881773034896102378336415142 \cdot 10^{83}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{y - x}{t}}{\frac{1}{z}}\\ \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)))