Average Error: 0.0 → 0.0
Time: 782.0ms
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 r166952 = x;
        double r166953 = r166952 * r166952;
        double r166954 = y;
        double r166955 = r166954 * r166954;
        double r166956 = r166953 - r166955;
        return r166956;
}

double f(double x, double y) {
        double r166957 = x;
        double r166958 = y;
        double r166959 = r166957 + r166958;
        double r166960 = r166957 - r166958;
        double r166961 = r166959 * r166960;
        return r166961;
}

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