Average Error: 0.0 → 0.0
Time: 12.9s
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 r36719100 = x;
        double r36719101 = r36719100 * r36719100;
        double r36719102 = 2.0;
        double r36719103 = r36719100 * r36719102;
        double r36719104 = y;
        double r36719105 = r36719103 * r36719104;
        double r36719106 = r36719101 + r36719105;
        double r36719107 = r36719104 * r36719104;
        double r36719108 = r36719106 + r36719107;
        return r36719108;
}

double f(double x, double y) {
        double r36719109 = 2.0;
        double r36719110 = y;
        double r36719111 = r36719109 * r36719110;
        double r36719112 = x;
        double r36719113 = r36719111 * r36719112;
        double r36719114 = r36719110 * r36719110;
        double r36719115 = r36719112 * r36719112;
        double r36719116 = r36719114 + r36719115;
        double r36719117 = r36719113 + r36719116;
        return r36719117;
}

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 2019158 
(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)))