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




Bits error versus a




Bits error versus b
Results
| Original | 0.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 0.0
Taylor expanded around 0 0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2020071 +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)))