Average Error: 0.0 → 0.0
Time: 3.5s
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 r3115266 = x;
        double r3115267 = r3115266 * r3115266;
        double r3115268 = y;
        double r3115269 = r3115268 * r3115268;
        double r3115270 = r3115267 - r3115269;
        return r3115270;
}

double f(double x, double y) {
        double r3115271 = x;
        double r3115272 = y;
        double r3115273 = r3115271 + r3115272;
        double r3115274 = r3115271 - r3115272;
        double r3115275 = r3115273 * r3115274;
        return r3115275;
}

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(y + x\right) \cdot \left(x - y\right)}\]
  4. Final simplification0.0

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

Reproduce

herbie shell --seed 2019156 
(FPCore (x y)
  :name "Examples.Basics.BasicTests:f2 from sbv-4.4"
  (- (* x x) (* y y)))