Average Error: 6.4 → 1.5
Time: 8.0s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.6809054761397501 \cdot 10^{-10}:\\ \;\;\;\;x + z \cdot \frac{y - x}{t}\\ \mathbf{elif}\;t \le 2.3137374841890364 \cdot 10^{-267}:\\ \;\;\;\;\left(\frac{z \cdot y}{t} - \frac{x \cdot z}{t}\right) + x\\ \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}\;t \le -1.6809054761397501 \cdot 10^{-10}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r8558858 = x;
        double r8558859 = y;
        double r8558860 = r8558859 - r8558858;
        double r8558861 = z;
        double r8558862 = r8558860 * r8558861;
        double r8558863 = t;
        double r8558864 = r8558862 / r8558863;
        double r8558865 = r8558858 + r8558864;
        return r8558865;
}

double f(double x, double y, double z, double t) {
        double r8558866 = t;
        double r8558867 = -1.6809054761397501e-10;
        bool r8558868 = r8558866 <= r8558867;
        double r8558869 = x;
        double r8558870 = z;
        double r8558871 = y;
        double r8558872 = r8558871 - r8558869;
        double r8558873 = r8558872 / r8558866;
        double r8558874 = r8558870 * r8558873;
        double r8558875 = r8558869 + r8558874;
        double r8558876 = 2.3137374841890364e-267;
        bool r8558877 = r8558866 <= r8558876;
        double r8558878 = r8558870 * r8558871;
        double r8558879 = r8558878 / r8558866;
        double r8558880 = r8558869 * r8558870;
        double r8558881 = r8558880 / r8558866;
        double r8558882 = r8558879 - r8558881;
        double r8558883 = r8558882 + r8558869;
        double r8558884 = r8558866 / r8558870;
        double r8558885 = r8558872 / r8558884;
        double r8558886 = r8558869 + r8558885;
        double r8558887 = r8558877 ? r8558883 : r8558886;
        double r8558888 = r8558868 ? r8558875 : r8558887;
        return r8558888;
}

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
Target1.9
Herbie1.5
\[\begin{array}{l} \mathbf{if}\;x \lt -9.025511195533005 \cdot 10^{-135}:\\ \;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\ \mathbf{elif}\;x \lt 4.275032163700715 \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 t < -1.6809054761397501e-10

    1. Initial program 9.8

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

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

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

    if -1.6809054761397501e-10 < t < 2.3137374841890364e-267

    1. Initial program 2.0

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    4. Taylor expanded around 0 2.0

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

    if 2.3137374841890364e-267 < t

    1. Initial program 6.0

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

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

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

Reproduce

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