Average Error: 0.0 → 0.0
Time: 807.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 r242440 = x;
        double r242441 = r242440 * r242440;
        double r242442 = y;
        double r242443 = r242442 * r242442;
        double r242444 = r242441 - r242443;
        return r242444;
}

double f(double x, double y) {
        double r242445 = x;
        double r242446 = y;
        double r242447 = r242445 + r242446;
        double r242448 = r242445 - r242446;
        double r242449 = r242447 * r242448;
        return r242449;
}

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