\left(d1 \cdot 3 + d1 \cdot d2\right) + d1 \cdot d3
\mathsf{fma}\left(3, d1, \mathsf{fma}\left(d1, d3, d1 \cdot d2\right)\right)double code(double d1, double d2, double d3) {
return (((d1 * 3.0) + (d1 * d2)) + (d1 * d3));
}
double code(double d1, double d2, double d3) {
return fma(3.0, d1, fma(d1, d3, (d1 * d2)));
}




Bits error versus d1




Bits error versus d2




Bits error versus d3
Results
| Original | 0.1 |
|---|---|
| Target | 0.1 |
| Herbie | 0.0 |
Initial program 0.1
Simplified0.0
Taylor expanded around 0 0.1
Simplified0.0
Final simplification0.0
herbie shell --seed 2020105 +o rules:numerics
(FPCore (d1 d2 d3)
:name "FastMath test3"
:precision binary64
:herbie-target
(* d1 (+ (+ 3 d2) d3))
(+ (+ (* d1 3) (* d1 d2)) (* d1 d3)))