a \cdot a - b \cdot b
\mathsf{fma}\left(a \cdot 1, a, -b \cdot b\right)double code(double a, double b) {
return ((a * a) - (b * b));
}
double code(double a, double b) {
return fma((a * 1.0), a, -(b * b));
}




Bits error versus a




Bits error versus b
Results
| Original | 0.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 0.0
rmApplied *-un-lft-identity0.0
Applied associate-*r*0.0
Applied fma-neg0.0
Final simplification0.0
herbie shell --seed 2020066 +o rules:numerics
(FPCore (a b)
:name "Difference of squares"
:precision binary64
:herbie-target
(* (+ a b) (- a b))
(- (* a a) (* b b)))