Average Error: 0.0 → 0.0
Time: 3.2s
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 r32101218 = x;
        double r32101219 = r32101218 * r32101218;
        double r32101220 = 2.0;
        double r32101221 = r32101218 * r32101220;
        double r32101222 = y;
        double r32101223 = r32101221 * r32101222;
        double r32101224 = r32101219 + r32101223;
        double r32101225 = r32101222 * r32101222;
        double r32101226 = r32101224 + r32101225;
        return r32101226;
}

double f(double x, double y) {
        double r32101227 = 2.0;
        double r32101228 = y;
        double r32101229 = r32101227 * r32101228;
        double r32101230 = x;
        double r32101231 = r32101229 * r32101230;
        double r32101232 = r32101228 * r32101228;
        double r32101233 = r32101230 * r32101230;
        double r32101234 = r32101232 + r32101233;
        double r32101235 = r32101231 + r32101234;
        return r32101235;
}

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

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

    \[\leadsto \color{blue}{\left(y \cdot y + x \cdot x\right) + x \cdot \left(y \cdot 2.0\right)}\]
  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 2019163 
(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)))