Average Error: 0.0 → 0.0
Time: 10.3s
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 r32002670 = x;
        double r32002671 = r32002670 * r32002670;
        double r32002672 = 2.0;
        double r32002673 = r32002670 * r32002672;
        double r32002674 = y;
        double r32002675 = r32002673 * r32002674;
        double r32002676 = r32002671 + r32002675;
        double r32002677 = r32002674 * r32002674;
        double r32002678 = r32002676 + r32002677;
        return r32002678;
}

double f(double x, double y) {
        double r32002679 = 2.0;
        double r32002680 = y;
        double r32002681 = r32002679 * r32002680;
        double r32002682 = x;
        double r32002683 = r32002681 * r32002682;
        double r32002684 = r32002680 * r32002680;
        double r32002685 = r32002682 * r32002682;
        double r32002686 = r32002684 + r32002685;
        double r32002687 = r32002683 + r32002686;
        return r32002687;
}

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