Average Error: 6.2 → 1.7
Time: 13.9s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1597283977310176280576:\\ \;\;\;\;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}\;z \le -1597283977310176280576:\\
\;\;\;\;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 r385818 = x;
        double r385819 = y;
        double r385820 = r385819 - r385818;
        double r385821 = z;
        double r385822 = r385820 * r385821;
        double r385823 = t;
        double r385824 = r385822 / r385823;
        double r385825 = r385818 + r385824;
        return r385825;
}

double f(double x, double y, double z, double t) {
        double r385826 = z;
        double r385827 = -1.5972839773101763e+21;
        bool r385828 = r385826 <= r385827;
        double r385829 = x;
        double r385830 = y;
        double r385831 = r385830 - r385829;
        double r385832 = t;
        double r385833 = r385831 / r385832;
        double r385834 = r385833 * r385826;
        double r385835 = r385829 + r385834;
        double r385836 = r385832 / r385826;
        double r385837 = r385831 / r385836;
        double r385838 = r385829 + r385837;
        double r385839 = r385828 ? r385835 : r385838;
        return r385839;
}

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.2
Target2.0
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.5972839773101763e+21

    1. Initial program 17.5

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity3.5

      \[\leadsto x + \color{blue}{1 \cdot \frac{y - x}{\frac{t}{z}}}\]
    6. Applied *-un-lft-identity3.5

      \[\leadsto \color{blue}{1 \cdot x} + 1 \cdot \frac{y - x}{\frac{t}{z}}\]
    7. Applied distribute-lft-out3.5

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

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

    if -1.5972839773101763e+21 < z

    1. Initial program 3.8

      \[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 2 regimes into one program.
  4. Final simplification1.7

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

Reproduce

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