Average Error: 0.0 → 0.0
Time: 9.1s
Precision: 64
\[x \cdot x - y \cdot y\]
\[\left(x - y\right) \cdot x + y \cdot \left(x - y\right)\]
x \cdot x - y \cdot y
\left(x - y\right) \cdot x + y \cdot \left(x - y\right)
double f(double x, double y) {
        double r178131 = x;
        double r178132 = r178131 * r178131;
        double r178133 = y;
        double r178134 = r178133 * r178133;
        double r178135 = r178132 - r178134;
        return r178135;
}

double f(double x, double y) {
        double r178136 = x;
        double r178137 = y;
        double r178138 = r178136 - r178137;
        double r178139 = r178138 * r178136;
        double r178140 = r178137 * r178138;
        double r178141 = r178139 + r178140;
        return r178141;
}

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

    \[\leadsto \color{blue}{\left(x - y\right) \cdot \left(x + y\right)}\]
  3. Using strategy rm
  4. Applied distribute-lft-in0.0

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

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

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

Reproduce

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