Average Error: 0.0 → 0.0
Time: 9.4s
Precision: 64
\[a \cdot a - b \cdot b\]
\[\left(a + b\right) \cdot \left(a - b\right)\]
a \cdot a - b \cdot b
\left(a + b\right) \cdot \left(a - b\right)
double f(double a, double b) {
        double r1787789 = a;
        double r1787790 = r1787789 * r1787789;
        double r1787791 = b;
        double r1787792 = r1787791 * r1787791;
        double r1787793 = r1787790 - r1787792;
        return r1787793;
}

double f(double a, double b) {
        double r1787794 = a;
        double r1787795 = b;
        double r1787796 = r1787794 + r1787795;
        double r1787797 = r1787794 - r1787795;
        double r1787798 = r1787796 * r1787797;
        return r1787798;
}

Error

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[a \cdot a - b \cdot b\]
  2. Using strategy rm
  3. Applied difference-of-squares0.0

    \[\leadsto \color{blue}{\left(a + b\right) \cdot \left(a - b\right)}\]
  4. Final simplification0.0

    \[\leadsto \left(a + b\right) \cdot \left(a - b\right)\]

Reproduce

herbie shell --seed 1 
(FPCore (a b)
  :name "a*a-b*b"
  :precision binary64
  (- (* a a) (* b b)))