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 r33640235 = x;
        double r33640236 = y;
        double r33640237 = r33640235 + r33640236;
        double r33640238 = r33640237 * r33640237;
        return r33640238;
}

double f(double x, double y) {
        double r33640239 = y;
        double r33640240 = x;
        double r33640241 = r33640239 * r33640240;
        double r33640242 = r33640241 + r33640241;
        double r33640243 = r33640239 * r33640239;
        double r33640244 = r33640242 + r33640243;
        double r33640245 = r33640240 * r33640240;
        double r33640246 = r33640244 + r33640245;
        return r33640246;
}

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