Average Error: 6.6 → 1.8
Time: 4.0s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le 5.1783536289534414 \cdot 10^{-76}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \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 5.1783536289534414 \cdot 10^{-76}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r503803 = x;
        double r503804 = y;
        double r503805 = r503804 - r503803;
        double r503806 = z;
        double r503807 = r503805 * r503806;
        double r503808 = t;
        double r503809 = r503807 / r503808;
        double r503810 = r503803 + r503809;
        return r503810;
}

double f(double x, double y, double z, double t) {
        double r503811 = z;
        double r503812 = 5.1783536289534414e-76;
        bool r503813 = r503811 <= r503812;
        double r503814 = x;
        double r503815 = y;
        double r503816 = r503815 - r503814;
        double r503817 = t;
        double r503818 = r503817 / r503811;
        double r503819 = r503816 / r503818;
        double r503820 = r503814 + r503819;
        double r503821 = r503816 / r503817;
        double r503822 = r503821 * r503811;
        double r503823 = r503814 + r503822;
        double r503824 = r503813 ? r503820 : r503823;
        return r503824;
}

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.8
\[\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 2 regimes
  2. if z < 5.1783536289534414e-76

    1. Initial program 4.9

      \[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}}}\]

    if 5.1783536289534414e-76 < z

    1. Initial program 11.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le 5.1783536289534414 \cdot 10^{-76}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{t} \cdot z\\ \end{array}\]

Reproduce

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