Average Error: 0.0 → 0.0
Time: 10.6s
Precision: 64
\[2.0 \cdot \left(x \cdot x - x \cdot y\right)\]
\[x \cdot \left(x \cdot 2.0\right) + \left(x \cdot 2.0\right) \cdot \left(-y\right)\]
2.0 \cdot \left(x \cdot x - x \cdot y\right)
x \cdot \left(x \cdot 2.0\right) + \left(x \cdot 2.0\right) \cdot \left(-y\right)
double f(double x, double y) {
        double r28159666 = 2.0;
        double r28159667 = x;
        double r28159668 = r28159667 * r28159667;
        double r28159669 = y;
        double r28159670 = r28159667 * r28159669;
        double r28159671 = r28159668 - r28159670;
        double r28159672 = r28159666 * r28159671;
        return r28159672;
}

double f(double x, double y) {
        double r28159673 = x;
        double r28159674 = 2.0;
        double r28159675 = r28159673 * r28159674;
        double r28159676 = r28159673 * r28159675;
        double r28159677 = y;
        double r28159678 = -r28159677;
        double r28159679 = r28159675 * r28159678;
        double r28159680 = r28159676 + r28159679;
        return r28159680;
}

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-rgt-in0.0

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

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

Reproduce

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