\left(a + b\right) \cdot \left(a + b\right)
\mathsf{fma}\left(\mathsf{fma}\left(2, a, b\right), b, {a}^{2}\right)double code(double a, double b) {
return ((double) (((double) (a + b)) * ((double) (a + b))));
}
double code(double a, double b) {
return ((double) fma(((double) fma(2.0, a, b)), b, ((double) 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
rmApplied add-cbrt-cube0.5
Applied add-cbrt-cube0.8
Applied cbrt-unprod0.5
Simplified0.5
Taylor expanded around 0 0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2020123 +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)))