Average Error: 0.0 → 0.0
Time: 10.4s
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 r27598143 = x;
        double r27598144 = r27598143 * r27598143;
        double r27598145 = 2.0;
        double r27598146 = r27598143 * r27598145;
        double r27598147 = y;
        double r27598148 = r27598146 * r27598147;
        double r27598149 = r27598144 + r27598148;
        double r27598150 = r27598147 * r27598147;
        double r27598151 = r27598149 + r27598150;
        return r27598151;
}

double f(double x, double y) {
        double r27598152 = 2.0;
        double r27598153 = y;
        double r27598154 = r27598152 * r27598153;
        double r27598155 = x;
        double r27598156 = r27598154 * r27598155;
        double r27598157 = r27598153 * r27598153;
        double r27598158 = r27598155 * r27598155;
        double r27598159 = r27598157 + r27598158;
        double r27598160 = r27598156 + r27598159;
        return r27598160;
}

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