Average Error: 6.5 → 0.7
Time: 2.2s
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{y - x}{t} \cdot z\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot z}{t} \le 5.341209302805126244331680067677643806813 \cdot 10^{306}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \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}\;x + \frac{\left(y - x\right) \cdot z}{t} = -\infty:\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\

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

\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r462354 = x;
        double r462355 = y;
        double r462356 = r462355 - r462354;
        double r462357 = z;
        double r462358 = r462356 * r462357;
        double r462359 = t;
        double r462360 = r462358 / r462359;
        double r462361 = r462354 + r462360;
        return r462361;
}

double f(double x, double y, double z, double t) {
        double r462362 = x;
        double r462363 = y;
        double r462364 = r462363 - r462362;
        double r462365 = z;
        double r462366 = r462364 * r462365;
        double r462367 = t;
        double r462368 = r462366 / r462367;
        double r462369 = r462362 + r462368;
        double r462370 = -inf.0;
        bool r462371 = r462369 <= r462370;
        double r462372 = r462364 / r462367;
        double r462373 = r462372 * r462365;
        double r462374 = r462362 + r462373;
        double r462375 = 5.341209302805126e+306;
        bool r462376 = r462369 <= r462375;
        double r462377 = r462367 / r462365;
        double r462378 = r462364 / r462377;
        double r462379 = r462362 + r462378;
        double r462380 = r462376 ? r462369 : r462379;
        double r462381 = r462371 ? r462374 : r462380;
        return r462381;
}

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.5
Target2.0
Herbie0.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 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. Using strategy rm
    5. Applied associate-/r/0.2

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

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

    1. Initial program 0.7

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

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

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

      \[\leadsto x + \color{blue}{\left(y - x\right)} \cdot \frac{z}{t}\]
    6. Using strategy rm
    7. Applied associate-*r/0.7

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

    if 5.341209302805126e+306 < (+ x (/ (* (- y x) z) t))

    1. Initial program 62.1

      \[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}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.7

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

Reproduce

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