\left(a + b\right) \cdot \left(a + b\right)
\mathsf{fma}\left(a, a, \mathsf{fma}\left(2, a \cdot b, {b}^{2}\right)\right)double code(double a, double b) {
return ((a + b) * (a + b));
}
double code(double a, double b) {
return fma(a, a, fma(2.0, (a * b), pow(b, 2.0)));
}




Bits error versus a




Bits error versus b
Results
| Original | 0.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0 |
Initial program 0.0
rmApplied distribute-lft-in0.0
Simplified0.0
Simplified0.0
Taylor expanded around 0 0.0
Simplified0
Final simplification0
herbie shell --seed 2020057 +o rules:numerics
(FPCore (a b)
:name "Expression 4, p15"
:precision binary64
:pre (and (<= 5 a 10) (<= 0.0 b 0.001))
:herbie-target
(+ (+ (+ (* b a) (* b b)) (* b a)) (* a a))
(* (+ a b) (+ a b)))