Average Error: 0.0 → 0.0
Time: 4.4s
Precision: 64
\[x \cdot x - y \cdot y\]
\[\left(y + x\right) \cdot \left(x - y\right)\]
x \cdot x - y \cdot y
\left(y + x\right) \cdot \left(x - y\right)
double f(double x, double y) {
        double r148048 = x;
        double r148049 = r148048 * r148048;
        double r148050 = y;
        double r148051 = r148050 * r148050;
        double r148052 = r148049 - r148051;
        return r148052;
}

double f(double x, double y) {
        double r148053 = y;
        double r148054 = x;
        double r148055 = r148053 + r148054;
        double r148056 = r148054 - r148053;
        double r148057 = r148055 * r148056;
        return r148057;
}

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. Simplified0.0

    \[\leadsto \color{blue}{\left(y + x\right)} \cdot \left(x - y\right)\]
  5. Final simplification0.0

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

Reproduce

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