Average Error: 0.0 → 0.0
Time: 1.5s
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(x \cdot x + y \cdot y\right)\]
\left(x \cdot x + \left(x \cdot 2\right) \cdot y\right) + y \cdot y
\left(2 \cdot y\right) \cdot x + \left(x \cdot x + y \cdot y\right)
double f(double x, double y) {
        double r636605 = x;
        double r636606 = r636605 * r636605;
        double r636607 = 2.0;
        double r636608 = r636605 * r636607;
        double r636609 = y;
        double r636610 = r636608 * r636609;
        double r636611 = r636606 + r636610;
        double r636612 = r636609 * r636609;
        double r636613 = r636611 + r636612;
        return r636613;
}

double f(double x, double y) {
        double r636614 = 2.0;
        double r636615 = y;
        double r636616 = r636614 * r636615;
        double r636617 = x;
        double r636618 = r636616 * r636617;
        double r636619 = r636617 * r636617;
        double r636620 = r636615 * r636615;
        double r636621 = r636619 + r636620;
        double r636622 = r636618 + r636621;
        return r636622;
}

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. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{\left({x}^{2} + 2 \cdot \left(x \cdot y\right)\right)} + y \cdot y\]
  3. Simplified0.0

    \[\leadsto \color{blue}{x \cdot \left(2 \cdot y + x\right)} + y \cdot y\]
  4. Using strategy rm
  5. Applied distribute-rgt-in0.0

    \[\leadsto \color{blue}{\left(\left(2 \cdot y\right) \cdot x + x \cdot x\right)} + y \cdot y\]
  6. Applied associate-+l+0.0

    \[\leadsto \color{blue}{\left(2 \cdot y\right) \cdot x + \left(x \cdot x + y \cdot y\right)}\]
  7. Final simplification0.0

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

Reproduce

herbie shell --seed 2020047 
(FPCore (x y)
  :name "Examples.Basics.ProofTests:f4 from sbv-4.4"
  :precision binary64

  :herbie-target
  (+ (* x x) (+ (* y y) (* (* x y) 2)))

  (+ (+ (* x x) (* (* x 2) y)) (* y y)))