Average Error: 0.0 → 0.0
Time: 1.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 r107543 = x;
        double r107544 = r107543 * r107543;
        double r107545 = y;
        double r107546 = r107545 * r107545;
        double r107547 = r107544 - r107546;
        return r107547;
}

double f(double x, double y) {
        double r107548 = x;
        double r107549 = y;
        double r107550 = r107548 + r107549;
        double r107551 = r107548 - r107549;
        double r107552 = r107550 * r107551;
        return r107552;
}

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. Using strategy rm
  3. Applied difference-of-squares0.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 1978988140 
(FPCore (x y)
  :name "Examples.Basics.BasicTests:f2 from sbv-4.4"
  :precision binary64
  (- (* x x) (* y y)))