Average Error: 0.0 → 0.0
Time: 6.9s
Precision: 64
\[\left(x + y\right) \cdot \left(x + y\right)\]
\[\left(\left(y \cdot x + y \cdot x\right) + y \cdot y\right) + x \cdot x\]
\left(x + y\right) \cdot \left(x + y\right)
\left(\left(y \cdot x + y \cdot x\right) + y \cdot y\right) + x \cdot x
double f(double x, double y) {
        double r34642247 = x;
        double r34642248 = y;
        double r34642249 = r34642247 + r34642248;
        double r34642250 = r34642249 * r34642249;
        return r34642250;
}

double f(double x, double y) {
        double r34642251 = y;
        double r34642252 = x;
        double r34642253 = r34642251 * r34642252;
        double r34642254 = r34642253 + r34642253;
        double r34642255 = r34642251 * r34642251;
        double r34642256 = r34642254 + r34642255;
        double r34642257 = r34642252 * r34642252;
        double r34642258 = r34642256 + r34642257;
        return r34642258;
}

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 + 2 \cdot \left(y \cdot x\right)\right)\]

Derivation

  1. Initial program 0.0

    \[\left(x + y\right) \cdot \left(x + y\right)\]
  2. Taylor expanded around 0 0.0

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

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

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

Reproduce

herbie shell --seed 2019162 
(FPCore (x y)
  :name "Examples.Basics.BasicTests:f3 from sbv-4.4"

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

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