x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
\mathbf{if}\;\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot z}{t}\\
t_1 \leq -\infty \lor \neg \left(t_1 \leq 1.4451404226086927 \cdot 10^{+306}\right)
\end{array}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + \frac{y \cdot z}{t}\right) - \frac{x \cdot z}{t}\\
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
(FPCore (x y z t)
:precision binary64
(if (let* ((t_1 (+ x (/ (* (- y x) z) t))))
(or (<= t_1 (- INFINITY)) (not (<= t_1 1.4451404226086927e+306))))
(fma (- y x) (/ z t) x)
(- (+ x (/ (* y z) t)) (/ (* x z) t))))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 t_1 = x + (((y - x) * z) / t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 1.4451404226086927e+306)) {
tmp = fma((y - x), (z / t), x);
} else {
tmp = (x + ((y * z) / t)) - ((x * z) / t);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 6.7 |
|---|---|
| Target | 2.0 |
| Herbie | 0.7 |
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0 or 1.4451404226086927e306 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 63.0
Simplified0.4
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 1.4451404226086927e306Initial program 0.7
Simplified2.4
Taylor expanded in y around 0 0.7
Final simplification0.7
herbie shell --seed 2021280
(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)))