Average Error: 0.0 → 0.0
Time: 19.8s
Precision: 64
\[2.0 \cdot \left(x \cdot x - x \cdot y\right)\]
\[\left(2.0 \cdot x\right) \cdot x + \left(2.0 \cdot x\right) \cdot \left(-y\right)\]
2.0 \cdot \left(x \cdot x - x \cdot y\right)
\left(2.0 \cdot x\right) \cdot x + \left(2.0 \cdot x\right) \cdot \left(-y\right)
double f(double x, double y) {
        double r28276424 = 2.0;
        double r28276425 = x;
        double r28276426 = r28276425 * r28276425;
        double r28276427 = y;
        double r28276428 = r28276425 * r28276427;
        double r28276429 = r28276426 - r28276428;
        double r28276430 = r28276424 * r28276429;
        return r28276430;
}

double f(double x, double y) {
        double r28276431 = 2.0;
        double r28276432 = x;
        double r28276433 = r28276431 * r28276432;
        double r28276434 = r28276433 * r28276432;
        double r28276435 = y;
        double r28276436 = -r28276435;
        double r28276437 = r28276433 * r28276436;
        double r28276438 = r28276434 + r28276437;
        return r28276438;
}

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.0\right) \cdot \left(x - y\right)\]

Derivation

  1. Initial program 0.0

    \[2.0 \cdot \left(x \cdot x - x \cdot y\right)\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\left(2.0 \cdot x\right) \cdot \left(x - y\right)}\]
  3. Using strategy rm
  4. Applied sub-neg0.0

    \[\leadsto \left(2.0 \cdot x\right) \cdot \color{blue}{\left(x + \left(-y\right)\right)}\]
  5. Applied distribute-lft-in0.0

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

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

Reproduce

herbie shell --seed 2019165 
(FPCore (x y)
  :name "Linear.Matrix:fromQuaternion from linear-1.19.1.3, A"

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

  (* 2.0 (- (* x x) (* x y))))