Average Error: 0.0 → 0.0
Time: 11.3s
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 r6697090 = x;
        double r6697091 = r6697090 * r6697090;
        double r6697092 = y;
        double r6697093 = r6697092 * r6697092;
        double r6697094 = r6697091 - r6697093;
        return r6697094;
}

double f(double x, double y) {
        double r6697095 = x;
        double r6697096 = y;
        double r6697097 = r6697095 + r6697096;
        double r6697098 = r6697095 - r6697096;
        double r6697099 = r6697097 * r6697098;
        return r6697099;
}

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. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{{x}^{2} - {y}^{2}}\]
  3. Simplified0.0

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

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

Reproduce

herbie shell --seed 2019169 +o rules:numerics
(FPCore (x y)
  :name "Examples.Basics.BasicTests:f2 from sbv-4.4"
  (- (* x x) (* y y)))