Average Error: 0.0 → 0.0
Time: 6.5s
Precision: 64
\[\left(x + y\right) \cdot \left(x + y\right)\]
\[\left(2 \cdot y + x\right) \cdot x + y \cdot y\]
\left(x + y\right) \cdot \left(x + y\right)
\left(2 \cdot y + x\right) \cdot x + y \cdot y
double f(double x, double y) {
        double r16288263 = x;
        double r16288264 = y;
        double r16288265 = r16288263 + r16288264;
        double r16288266 = r16288265 * r16288265;
        return r16288266;
}

double f(double x, double y) {
        double r16288267 = 2.0;
        double r16288268 = y;
        double r16288269 = r16288267 * r16288268;
        double r16288270 = x;
        double r16288271 = r16288269 + r16288270;
        double r16288272 = r16288271 * r16288270;
        double r16288273 = r16288268 * r16288268;
        double r16288274 = r16288272 + r16288273;
        return r16288274;
}

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}{x \cdot x + \left(\left(2 \cdot x\right) \cdot y + y \cdot y\right)}\]
  4. Using strategy rm
  5. Applied distribute-rgt-out0.0

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

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

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

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

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

Reproduce

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

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

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