a \cdot a - b \cdot b
\left(\left|b\right| + \left|a\right|\right) \cdot \left(\left|a\right| + \left(-\left|b\right|\right)\right)
double code(double a, double b) {
return ((a * a) - (b * b));
}
double code(double a, double b) {
return ((fabs(b) + fabs(a)) * (fabs(a) + -fabs(b)));
}




Bits error versus a




Bits error versus b
Results
| Original | 0.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 0.0
rmApplied add-sqr-sqrt0.0
Applied add-sqr-sqrt0.0
Applied difference-of-squares0.0
Simplified0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2020066
(FPCore (a b)
:name "Difference of squares"
:precision binary64
:herbie-target
(* (+ a b) (- a b))
(- (* a a) (* b b)))