Average Error: 6.6 → 1.3
Time: 17.9s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{\left(y - x\right) \cdot z}{t} \le -4.088818265683742099563857037862035463705 \cdot 10^{255}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot z}{t} \le 1.816763390681394691313189929250285209119 \cdot 10^{242}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{t} \cdot \left(y - x\right) + x\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;x + \frac{\left(y - x\right) \cdot z}{t} \le -4.088818265683742099563857037862035463705 \cdot 10^{255}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot \left(y - x\right) + x\\

\end{array}
double f(double x, double y, double z, double t) {
        double r23915565 = x;
        double r23915566 = y;
        double r23915567 = r23915566 - r23915565;
        double r23915568 = z;
        double r23915569 = r23915567 * r23915568;
        double r23915570 = t;
        double r23915571 = r23915569 / r23915570;
        double r23915572 = r23915565 + r23915571;
        return r23915572;
}

double f(double x, double y, double z, double t) {
        double r23915573 = x;
        double r23915574 = y;
        double r23915575 = r23915574 - r23915573;
        double r23915576 = z;
        double r23915577 = r23915575 * r23915576;
        double r23915578 = t;
        double r23915579 = r23915577 / r23915578;
        double r23915580 = r23915573 + r23915579;
        double r23915581 = -4.088818265683742e+255;
        bool r23915582 = r23915580 <= r23915581;
        double r23915583 = r23915578 / r23915576;
        double r23915584 = r23915575 / r23915583;
        double r23915585 = r23915573 + r23915584;
        double r23915586 = 1.8167633906813947e+242;
        bool r23915587 = r23915580 <= r23915586;
        double r23915588 = r23915576 / r23915578;
        double r23915589 = r23915588 * r23915575;
        double r23915590 = r23915589 + r23915573;
        double r23915591 = r23915587 ? r23915580 : r23915590;
        double r23915592 = r23915582 ? r23915585 : r23915591;
        return r23915592;
}

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
Target2.1
Herbie1.3
\[\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 3 regimes
  2. if (+ x (/ (* (- y x) z) t)) < -4.088818265683742e+255

    1. Initial program 31.0

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

    if -4.088818265683742e+255 < (+ x (/ (* (- y x) z) t)) < 1.8167633906813947e+242

    1. Initial program 0.9

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

    if 1.8167633906813947e+242 < (+ x (/ (* (- y x) z) t))

    1. Initial program 25.1

      \[x + \frac{\left(y - x\right) \cdot z}{t}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity25.1

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

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

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

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

Reproduce

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