Average Error: 0.0 → 0.0
Time: 1.0s
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 r184303 = x;
        double r184304 = r184303 * r184303;
        double r184305 = y;
        double r184306 = r184305 * r184305;
        double r184307 = r184304 - r184306;
        return r184307;
}

double f(double x, double y) {
        double r184308 = x;
        double r184309 = y;
        double r184310 = r184308 + r184309;
        double r184311 = r184308 - r184309;
        double r184312 = r184310 * r184311;
        return r184312;
}

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 2020089 
(FPCore (x y)
  :name "Examples.Basics.BasicTests:f2 from sbv-4.4"
  :precision binary64
  (- (* x x) (* y y)))