Average Error: 6.7 → 2.5
Time: 4.2s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot z}{t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -3.28973051489677761 \cdot 10^{-258} \lor \neg \left(y \le 8.7429650448842387 \cdot 10^{-137}\right):\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{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}\;y \le -3.28973051489677761 \cdot 10^{-258} \lor \neg \left(y \le 8.7429650448842387 \cdot 10^{-137}\right):\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{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 r551743 = x;
        double r551744 = y;
        double r551745 = r551744 - r551743;
        double r551746 = z;
        double r551747 = r551745 * r551746;
        double r551748 = t;
        double r551749 = r551747 / r551748;
        double r551750 = r551743 + r551749;
        return r551750;
}

double f(double x, double y, double z, double t) {
        double r551751 = y;
        double r551752 = -3.2897305148967776e-258;
        bool r551753 = r551751 <= r551752;
        double r551754 = 8.742965044884239e-137;
        bool r551755 = r551751 <= r551754;
        double r551756 = !r551755;
        bool r551757 = r551753 || r551756;
        double r551758 = x;
        double r551759 = r551751 - r551758;
        double r551760 = z;
        double r551761 = t;
        double r551762 = r551760 / r551761;
        double r551763 = r551759 * r551762;
        double r551764 = r551758 + r551763;
        double r551765 = r551759 / r551761;
        double r551766 = 1.0;
        double r551767 = r551766 / r551760;
        double r551768 = r551765 / r551767;
        double r551769 = r551758 + r551768;
        double r551770 = r551757 ? r551764 : r551769;
        return r551770;
}

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
Herbie2.5
\[\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 y < -3.2897305148967776e-258 or 8.742965044884239e-137 < y

    1. Initial program 7.0

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

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

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

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

    if -3.2897305148967776e-258 < y < 8.742965044884239e-137

    1. Initial program 5.4

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    4. Using strategy rm
    5. Applied div-inv2.6

      \[\leadsto x + \frac{y - x}{\color{blue}{t \cdot \frac{1}{z}}}\]
    6. Applied associate-/r*5.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -3.28973051489677761 \cdot 10^{-258} \lor \neg \left(y \le 8.7429650448842387 \cdot 10^{-137}\right):\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{y - x}{t}}{\frac{1}{z}}\\ \end{array}\]

Reproduce

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