\mathsf{fma}\left(x, y, z\right) - \left(1 + \left(x \cdot y + z\right)\right)\begin{array}{l}
\mathbf{if}\;y \leq -1.3477441338726809 \cdot 10^{+135} \lor \neg \left(y \leq 2.8281805749579194 \cdot 10^{-36}\right):\\
\;\;\;\;-1 + \left(\left(\frac{1}{y \cdot x} + \mathsf{fma}\left(\frac{-1}{x}, \frac{1}{y}, z\right)\right) - z\right)\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(\left(\frac{y}{x} + \mathsf{fma}\left(\frac{-1}{x}, y, z\right)\right) - z\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 (<= y -1.3477441338726809e+135) (not (<= y 2.8281805749579194e-36))) (+ -1.0 (- (+ (/ 1.0 (* y x)) (fma (/ -1.0 x) (/ 1.0 y) z)) z)) (+ -1.0 (- (+ (/ y x) (fma (/ -1.0 x) y z)) z))))
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 ((y <= -1.3477441338726809e+135) || !(y <= 2.8281805749579194e-36)) {
tmp = -1.0 + (((1.0 / (y * x)) + fma((-1.0 / x), (1.0 / y), z)) - z);
} else {
tmp = -1.0 + (((y / x) + fma((-1.0 / x), y, z)) - z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 45.5 |
|---|---|
| Target | 0 |
| Herbie | 6.2 |
if y < -1.3477441338726809e135 or 2.8281805749579194e-36 < y Initial program 54.3
Taylor expanded around -inf 43.1
rmApplied associate--r+_binary64_137829.0
Taylor expanded around inf 5.3
Simplified5.3
if -1.3477441338726809e135 < y < 2.8281805749579194e-36Initial program 39.1
Taylor expanded around -inf 32.8
rmApplied associate--r+_binary64_13786.9
Final simplification6.2
herbie shell --seed 2020344
(FPCore (x y z)
:name "simple fma test"
:precision binary64
:herbie-target
-1.0
(- (fma x y z) (+ 1.0 (+ (* x y) z))))