Average Error: 0.0 → 0.0
Time: 5.7s
Precision: 64
\[\left(x + y\right) \cdot \left(x + y\right)\]
\[\left(x \cdot x + y \cdot y\right) + \left(y \cdot x\right) \cdot 2\]
\left(x + y\right) \cdot \left(x + y\right)
\left(x \cdot x + y \cdot y\right) + \left(y \cdot x\right) \cdot 2
double f(double x, double y) {
        double r33254048 = x;
        double r33254049 = y;
        double r33254050 = r33254048 + r33254049;
        double r33254051 = r33254050 * r33254050;
        return r33254051;
}

double f(double x, double y) {
        double r33254052 = x;
        double r33254053 = r33254052 * r33254052;
        double r33254054 = y;
        double r33254055 = r33254054 * r33254054;
        double r33254056 = r33254053 + r33254055;
        double r33254057 = r33254054 * r33254052;
        double r33254058 = 2.0;
        double r33254059 = r33254057 * r33254058;
        double r33254060 = r33254056 + r33254059;
        return r33254060;
}

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}{2 \cdot \left(x \cdot y\right) + \left(x \cdot x + y \cdot y\right)}\]
  4. Final simplification0.0

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

Reproduce

herbie shell --seed 2019165 
(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)))