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.7151087056876726 \cdot 10^{104}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y, x - x \cdot \frac{z}{t}\right)\\
\mathbf{elif}\;x + \frac{\left(y - x\right) \cdot z}{t} \le 4.2848485185006545 \cdot 10^{293}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(y - x\right) \cdot \frac{1}{t}, z, x\right)\\
\end{array}double code(double x, double y, double z, double t) {
return (x + (((y - x) * z) / t));
}
double code(double x, double y, double z, double t) {
double VAR;
if (((x + (((y - x) * z) / t)) <= -4.7151087056876726e+104)) {
VAR = fma((z / t), y, (x - (x * (z / t))));
} else {
double VAR_1;
if (((x + (((y - x) * z) / t)) <= 4.2848485185006545e+293)) {
VAR_1 = (x + (((y - x) * z) / t));
} else {
VAR_1 = fma(((y - x) * (1.0 / t)), z, x);
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.6 |
|---|---|
| Target | 1.9 |
| Herbie | 1.6 |
if (+ x (/ (* (- y x) z) t)) < -4.7151087056876726e+104Initial program 12.1
Simplified11.2
rmApplied div-inv11.3
Taylor expanded around 0 12.1
Simplified9.4
rmApplied *-un-lft-identity9.4
Applied times-frac2.4
Simplified2.4
if -4.7151087056876726e+104 < (+ x (/ (* (- y x) z) t)) < 4.2848485185006545e+293Initial program 1.0
if 4.2848485185006545e+293 < (+ x (/ (* (- y x) z) t)) Initial program 49.6
Simplified4.9
rmApplied div-inv5.0
Final simplification1.6
herbie shell --seed 2020102 +o rules:numerics
(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)))