Average Error: 0.0 → 0.0
Time: 11.8s
Precision: 64
\[\left(x + y\right) \cdot \left(x + y\right)\]
\[x \cdot x + \left(\left(x + y\right) + x\right) \cdot y\]
\left(x + y\right) \cdot \left(x + y\right)
x \cdot x + \left(\left(x + y\right) + x\right) \cdot y
double f(double x, double y) {
        double r27800404 = x;
        double r27800405 = y;
        double r27800406 = r27800404 + r27800405;
        double r27800407 = r27800406 * r27800406;
        return r27800407;
}

double f(double x, double y) {
        double r27800408 = x;
        double r27800409 = r27800408 * r27800408;
        double r27800410 = y;
        double r27800411 = r27800408 + r27800410;
        double r27800412 = r27800411 + r27800408;
        double r27800413 = r27800412 * r27800410;
        double r27800414 = r27800409 + r27800413;
        return r27800414;
}

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. Using strategy rm
  3. Applied distribute-rgt-in0.0

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

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

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

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

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

Reproduce

herbie shell --seed 2019162 +o rules:numerics
(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)))