Average Error: 0.0 → 0.0
Time: 13.1s
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 r16533553 = a;
        double r16533554 = r16533553 * r16533553;
        double r16533555 = b;
        double r16533556 = r16533555 * r16533555;
        double r16533557 = r16533554 - r16533556;
        return r16533557;
}

double f(double a, double b) {
        double r16533558 = a;
        double r16533559 = b;
        double r16533560 = r16533558 + r16533559;
        double r16533561 = r16533558 - r16533559;
        double r16533562 = r16533560 * r16533561;
        return r16533562;
}

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)))