Average Error: 6.6 → 0.8
Time: 17.5s
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:\\ \;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot z}{t} \le 6.459980878239823112823689377523232903306 \cdot 10^{298}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z}{t} \cdot \left(y - x\right)\\ \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:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r342680 = x;
        double r342681 = y;
        double r342682 = r342681 - r342680;
        double r342683 = z;
        double r342684 = r342682 * r342683;
        double r342685 = t;
        double r342686 = r342684 / r342685;
        double r342687 = r342680 + r342686;
        return r342687;
}

double f(double x, double y, double z, double t) {
        double r342688 = x;
        double r342689 = y;
        double r342690 = r342689 - r342688;
        double r342691 = z;
        double r342692 = r342690 * r342691;
        double r342693 = t;
        double r342694 = r342692 / r342693;
        double r342695 = r342688 + r342694;
        double r342696 = -inf.0;
        bool r342697 = r342695 <= r342696;
        double r342698 = r342693 / r342690;
        double r342699 = r342691 / r342698;
        double r342700 = r342688 + r342699;
        double r342701 = 6.459980878239823e+298;
        bool r342702 = r342695 <= r342701;
        double r342703 = r342691 / r342693;
        double r342704 = r342703 * r342690;
        double r342705 = r342688 + r342704;
        double r342706 = r342702 ? r342695 : r342705;
        double r342707 = r342697 ? r342700 : r342706;
        return r342707;
}

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
Herbie0.8
\[\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)) < -inf.0

    1. Initial program 64.0

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{t}{z}}}\]
    4. Taylor expanded around 0 64.0

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

      \[\leadsto x + \color{blue}{\frac{z}{\frac{t}{y - x}}}\]

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

    1. Initial program 0.8

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

    if 6.459980878239823e+298 < (+ x (/ (* (- y x) z) t))

    1. Initial program 52.3

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

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

      \[\leadsto x + \color{blue}{\frac{1}{\frac{\frac{t}{z}}{y - x}}}\]
    6. Using strategy rm
    7. Applied div-inv1.1

      \[\leadsto x + \frac{1}{\color{blue}{\frac{t}{z} \cdot \frac{1}{y - x}}}\]
    8. Applied add-cube-cbrt1.1

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

      \[\leadsto x + \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{t}{z}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{y - x}}}\]
    10. Simplified1.0

      \[\leadsto x + \color{blue}{\frac{z}{t}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{y - x}}\]
    11. Simplified0.9

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

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

Reproduce

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