Average Error: 0.0 → 0.0
Time: 13.7s
Precision: 64
\[\left(x \cdot x + \left(x \cdot 2.0\right) \cdot y\right) + y \cdot y\]
\[\left(2.0 \cdot y\right) \cdot x + \left(y \cdot y + x \cdot x\right)\]
\left(x \cdot x + \left(x \cdot 2.0\right) \cdot y\right) + y \cdot y
\left(2.0 \cdot y\right) \cdot x + \left(y \cdot y + x \cdot x\right)
double f(double x, double y) {
        double r31163828 = x;
        double r31163829 = r31163828 * r31163828;
        double r31163830 = 2.0;
        double r31163831 = r31163828 * r31163830;
        double r31163832 = y;
        double r31163833 = r31163831 * r31163832;
        double r31163834 = r31163829 + r31163833;
        double r31163835 = r31163832 * r31163832;
        double r31163836 = r31163834 + r31163835;
        return r31163836;
}

double f(double x, double y) {
        double r31163837 = 2.0;
        double r31163838 = y;
        double r31163839 = r31163837 * r31163838;
        double r31163840 = x;
        double r31163841 = r31163839 * r31163840;
        double r31163842 = r31163838 * r31163838;
        double r31163843 = r31163840 * r31163840;
        double r31163844 = r31163842 + r31163843;
        double r31163845 = r31163841 + r31163844;
        return r31163845;
}

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
\[x \cdot x + \left(y \cdot y + \left(x \cdot y\right) \cdot 2.0\right)\]

Derivation

  1. Initial program 0.0

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

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

    \[\leadsto y \cdot y + \color{blue}{\left(x \cdot x + \left(y \cdot 2.0\right) \cdot x\right)}\]
  5. Applied associate-+r+0.0

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

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

Reproduce

herbie shell --seed 2019162 
(FPCore (x y)
  :name "Examples.Basics.ProofTests:f4 from sbv-4.4"

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

  (+ (+ (* x x) (* (* x 2.0) y)) (* y y)))