Average Error: 0.0 → 0.0
Time: 7.7s
Precision: 64
\[2 \cdot \left(x \cdot x - x \cdot y\right)\]
\[\left(x \cdot \left(x - y\right)\right) \cdot 2\]
2 \cdot \left(x \cdot x - x \cdot y\right)
\left(x \cdot \left(x - y\right)\right) \cdot 2
double f(double x, double y) {
        double r629471 = 2.0;
        double r629472 = x;
        double r629473 = r629472 * r629472;
        double r629474 = y;
        double r629475 = r629472 * r629474;
        double r629476 = r629473 - r629475;
        double r629477 = r629471 * r629476;
        return r629477;
}

double f(double x, double y) {
        double r629478 = x;
        double r629479 = y;
        double r629480 = r629478 - r629479;
        double r629481 = r629478 * r629480;
        double r629482 = 2.0;
        double r629483 = r629481 * r629482;
        return r629483;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[\left(x \cdot 2\right) \cdot \left(x - y\right)\]

Derivation

  1. Initial program 0.0

    \[2 \cdot \left(x \cdot x - x \cdot y\right)\]
  2. Using strategy rm
  3. Applied prod-diff0.0

    \[\leadsto 2 \cdot \color{blue}{\left(\mathsf{fma}\left(x, x, -y \cdot x\right) + \mathsf{fma}\left(-y, x, y \cdot x\right)\right)}\]
  4. Simplified0.0

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

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

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

Reproduce

herbie shell --seed 2020042 +o rules:numerics
(FPCore (x y)
  :name "Linear.Matrix:fromQuaternion from linear-1.19.1.3, A"
  :precision binary64

  :herbie-target
  (* (* x 2) (- x y))

  (* 2 (- (* x x) (* x y))))