Average Error: 0.0 → 0.0
Time: 37.1s
Precision: 64
\[x \cdot x - y \cdot y\]
\[\left(x - y\right) \cdot \left(x + y\right)\]
x \cdot x - y \cdot y
\left(x - y\right) \cdot \left(x + y\right)
double f(double x, double y) {
        double r8473426 = x;
        double r8473427 = r8473426 * r8473426;
        double r8473428 = y;
        double r8473429 = r8473428 * r8473428;
        double r8473430 = r8473427 - r8473429;
        return r8473430;
}

double f(double x, double y) {
        double r8473431 = x;
        double r8473432 = y;
        double r8473433 = r8473431 - r8473432;
        double r8473434 = r8473431 + r8473432;
        double r8473435 = r8473433 * r8473434;
        return r8473435;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[x \cdot x - y \cdot y\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{{x}^{2} - {y}^{2}}\]
  3. Simplified0.0

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

    \[\leadsto \left(x - y\right) \cdot \left(x + y\right)\]

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y)
  :name "Examples.Basics.BasicTests:f2 from sbv-4.4"
  (- (* x x) (* y y)))