x + \frac{\left(y - x\right) \cdot z}{t}
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z}{t}, x\right)\\
\mathbf{if}\;x \leq -6.2284847009143676 \cdot 10^{+57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.178828194994505 \cdot 10^{-220}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (- y x) (/ z t) x)))
(if (<= x -6.2284847009143676e+57)
t_1
(if (<= x 1.178828194994505e-220) (+ x (* z (/ (- y x) t))) t_1))))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 = fma((y - x), (z / t), x);
double tmp;
if (x <= -6.2284847009143676e+57) {
tmp = t_1;
} else if (x <= 1.178828194994505e-220) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = t_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 6.5 |
|---|---|
| Target | 1.8 |
| Herbie | 2.4 |
if x < -6.22848470091436762e57 or 1.17882819499450501e-220 < x Initial program 7.4
Simplified0.9
if -6.22848470091436762e57 < x < 1.17882819499450501e-220Initial program 5.2
Simplified3.4
Applied fma-udef_binary643.4
Simplified4.6
Applied +-commutative_binary644.6
Final simplification2.4
herbie shell --seed 2022077
(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)))