Average Error: 0.0 → 0.0
Time: 21.7s
Precision: 64
\[\left(x \cdot x + \left(x \cdot 2\right) \cdot y\right) + y \cdot y\]
\[\left(2 \cdot y\right) \cdot x + \left(y \cdot y + x \cdot x\right)\]
\left(x \cdot x + \left(x \cdot 2\right) \cdot y\right) + y \cdot y
\left(2 \cdot y\right) \cdot x + \left(y \cdot y + x \cdot x\right)
double f(double x, double y) {
        double r31971712 = x;
        double r31971713 = r31971712 * r31971712;
        double r31971714 = 2.0;
        double r31971715 = r31971712 * r31971714;
        double r31971716 = y;
        double r31971717 = r31971715 * r31971716;
        double r31971718 = r31971713 + r31971717;
        double r31971719 = r31971716 * r31971716;
        double r31971720 = r31971718 + r31971719;
        return r31971720;
}

double f(double x, double y) {
        double r31971721 = 2.0;
        double r31971722 = y;
        double r31971723 = r31971721 * r31971722;
        double r31971724 = x;
        double r31971725 = r31971723 * r31971724;
        double r31971726 = r31971722 * r31971722;
        double r31971727 = r31971724 * r31971724;
        double r31971728 = r31971726 + r31971727;
        double r31971729 = r31971725 + r31971728;
        return r31971729;
}

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\right)\]

Derivation

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{y \cdot y + x \cdot \left(x + y \cdot 2\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\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\right) \cdot x}\]
  6. Final simplification0.0

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

Reproduce

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