Average Error: 0.0 → 0.0
Time: 4.3s
Precision: 64
\[2 \cdot \left(x \cdot x - x \cdot y\right)\]
\[\left(2 \cdot x\right) \cdot x + \left(2 \cdot x\right) \cdot \left(-y\right)\]
2 \cdot \left(x \cdot x - x \cdot y\right)
\left(2 \cdot x\right) \cdot x + \left(2 \cdot x\right) \cdot \left(-y\right)
double f(double x, double y) {
        double r28696208 = 2.0;
        double r28696209 = x;
        double r28696210 = r28696209 * r28696209;
        double r28696211 = y;
        double r28696212 = r28696209 * r28696211;
        double r28696213 = r28696210 - r28696212;
        double r28696214 = r28696208 * r28696213;
        return r28696214;
}

double f(double x, double y) {
        double r28696215 = 2.0;
        double r28696216 = x;
        double r28696217 = r28696215 * r28696216;
        double r28696218 = r28696217 * r28696216;
        double r28696219 = y;
        double r28696220 = -r28696219;
        double r28696221 = r28696217 * r28696220;
        double r28696222 = r28696218 + r28696221;
        return r28696222;
}

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

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

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

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

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

Reproduce

herbie shell --seed 2019171 
(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))))