Average Error: 0.0 → 0.0
Time: 13.2s
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 r16876000 = a;
        double r16876001 = r16876000 * r16876000;
        double r16876002 = b;
        double r16876003 = r16876002 * r16876002;
        double r16876004 = r16876001 - r16876003;
        return r16876004;
}

double f(double a, double b) {
        double r16876005 = a;
        double r16876006 = b;
        double r16876007 = r16876005 + r16876006;
        double r16876008 = r16876005 - r16876006;
        double r16876009 = r16876007 * r16876008;
        return r16876009;
}

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. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{{a}^{2} - {b}^{2}}\]
  3. Simplified0.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"
  (- (* a a) (* b b)))