a \cdot a - b \cdot b
\mathsf{fma}\left(a, a, -b \cdot b\right)double code(double a, double b) {
return ((double) (((double) (a * a)) - ((double) (b * b))));
}
double code(double a, double b) {
return ((double) fma(a, a, ((double) -(((double) (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 fma-neg0.0
Final simplification0.0
herbie shell --seed 2020123 +o rules:numerics
(FPCore (a b)
:name "Difference of squares"
:precision binary64
:herbie-target
(* (+ a b) (- a b))
(- (* a a) (* b b)))