Average Error: 6.7 → 1.0
Time: 10.8s
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} = -\infty \lor \neg \left(x + \frac{\left(y - x\right) \cdot z}{t} \le 7.47453856091499786 \cdot 10^{296}\right):\\ \;\;\;\;\frac{y - x}{t} \cdot z + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \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} = -\infty \lor \neg \left(x + \frac{\left(y - x\right) \cdot z}{t} \le 7.47453856091499786 \cdot 10^{296}\right):\\
\;\;\;\;\frac{y - x}{t} \cdot z + x\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r606600 = x;
        double r606601 = y;
        double r606602 = r606601 - r606600;
        double r606603 = z;
        double r606604 = r606602 * r606603;
        double r606605 = t;
        double r606606 = r606604 / r606605;
        double r606607 = r606600 + r606606;
        return r606607;
}

double f(double x, double y, double z, double t) {
        double r606608 = x;
        double r606609 = y;
        double r606610 = r606609 - r606608;
        double r606611 = z;
        double r606612 = r606610 * r606611;
        double r606613 = t;
        double r606614 = r606612 / r606613;
        double r606615 = r606608 + r606614;
        double r606616 = -inf.0;
        bool r606617 = r606615 <= r606616;
        double r606618 = 7.474538560914998e+296;
        bool r606619 = r606615 <= r606618;
        double r606620 = !r606619;
        bool r606621 = r606617 || r606620;
        double r606622 = r606610 / r606613;
        double r606623 = r606622 * r606611;
        double r606624 = r606623 + r606608;
        double r606625 = r606621 ? r606624 : r606615;
        return r606625;
}

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.3
Herbie1.0
\[\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 (+ x (/ (* (- y x) z) t)) < -inf.0 or 7.474538560914998e+296 < (+ x (/ (* (- y x) z) t))

    1. Initial program 58.1

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

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

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

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

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

      \[\leadsto x + \frac{1}{t} \cdot \color{blue}{\left(\left(y - x\right) \cdot z\right)}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity58.1

      \[\leadsto x + \frac{1}{\color{blue}{1 \cdot t}} \cdot \left(\left(y - x\right) \cdot z\right)\]
    11. Applied *-un-lft-identity58.1

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

      \[\leadsto x + \color{blue}{\left(\frac{1}{1} \cdot \frac{1}{t}\right)} \cdot \left(\left(y - x\right) \cdot z\right)\]
    13. Applied associate-*l*58.1

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

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

    if -inf.0 < (+ x (/ (* (- y x) z) t)) < 7.474538560914998e+296

    1. Initial program 0.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{\left(y - x\right) \cdot z}{t} = -\infty \lor \neg \left(x + \frac{\left(y - x\right) \cdot z}{t} \le 7.47453856091499786 \cdot 10^{296}\right):\\ \;\;\;\;\frac{y - x}{t} \cdot z + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \end{array}\]

Reproduce

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