\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)
\begin{array}{l}
\mathbf{if}\;z \leq -2.1021206699534236 \lor \neg \left(z \leq 32767434791329.156\right):\\
\;\;\;\;\left(\mathsf{fma}\left(x, y, z\right) - z\right) - 1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(z + x \cdot y\right)\right)\\
\end{array}
(FPCore (x y z) :precision binary64 (- (fma x y z) (+ 1.0 (+ (* x y) z))))
(FPCore (x y z) :precision binary64 (if (or (<= z -2.1021206699534236) (not (<= z 32767434791329.156))) (- (- (fma x y z) z) 1.0) (- (fma x y z) (+ 1.0 (+ z (* x y))))))
double code(double x, double y, double z) {
return fma(x, y, z) - (1.0 + ((x * y) + z));
}
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.1021206699534236) || !(z <= 32767434791329.156)) {
tmp = (fma(x, y, z) - z) - 1.0;
} else {
tmp = fma(x, y, z) - (1.0 + (z + (x * y)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 45.3 |
|---|---|
| Target | 0 |
| Herbie | 24.4 |
if z < -2.1021206699534236 or 32767434791329.156 < z Initial program 61.2
Taylor expanded around 0 61.3
Simplified61.3
rmApplied associate--r+_binary6419.2
if -2.1021206699534236 < z < 32767434791329.156Initial program 29.6
Final simplification24.4
herbie shell --seed 2021205
(FPCore (x y z)
:name "simple fma test"
:precision binary64
:herbie-target
-1.0
(- (fma x y z) (+ 1.0 (+ (* x y) z))))