Average Error: 0.0 → 0.0
Time: 3.1s
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 r32384829 = x;
        double r32384830 = r32384829 * r32384829;
        double r32384831 = 2.0;
        double r32384832 = r32384829 * r32384831;
        double r32384833 = y;
        double r32384834 = r32384832 * r32384833;
        double r32384835 = r32384830 + r32384834;
        double r32384836 = r32384833 * r32384833;
        double r32384837 = r32384835 + r32384836;
        return r32384837;
}

double f(double x, double y) {
        double r32384838 = 2.0;
        double r32384839 = y;
        double r32384840 = r32384838 * r32384839;
        double r32384841 = x;
        double r32384842 = r32384840 * r32384841;
        double r32384843 = r32384839 * r32384839;
        double r32384844 = r32384841 * r32384841;
        double r32384845 = r32384843 + r32384844;
        double r32384846 = r32384842 + r32384845;
        return r32384846;
}

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