a \cdot \left(\left(b + c\right) + d\right)
\mathsf{fma}\left(b + c, a, a \cdot d\right)
(FPCore (a b c d) :precision binary64 (* a (+ (+ b c) d)))
(FPCore (a b c d) :precision binary64 (fma (+ b c) a (* a d)))
double code(double a, double b, double c, double d) {
return a * ((b + c) + d);
}
double code(double a, double b, double c, double d) {
return fma((b + c), a, (a * d));
}




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus d
| Original | 0.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 0.0
Applied distribute-rgt-in_binary640.0
Applied fma-def_binary640.0
Final simplification0.0
herbie shell --seed 2021275
(FPCore (a b c d)
:name "Expression, p14"
:precision binary64
:pre (and (and (and (and (<= 56789.0 a) (<= a 98765.0)) (and (<= 0.0 b) (<= b 1.0))) (and (<= 0.0 c) (<= c 0.0016773))) (and (<= 0.0 d) (<= d 0.0016773)))
:herbie-target
(+ (* a b) (* a (+ c d)))
(* a (+ (+ b c) d)))