Average Error: 0.2 → 0.1
Time: 12.6s
Precision: 64
\[\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y\]
\[x \cdot x + \left(3 \cdot y\right) \cdot y\]
\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y
x \cdot x + \left(3 \cdot y\right) \cdot y
double f(double x, double y) {
        double r363619 = x;
        double r363620 = r363619 * r363619;
        double r363621 = y;
        double r363622 = r363621 * r363621;
        double r363623 = r363620 + r363622;
        double r363624 = r363623 + r363622;
        double r363625 = r363624 + r363622;
        return r363625;
}

double f(double x, double y) {
        double r363626 = x;
        double r363627 = r363626 * r363626;
        double r363628 = 3.0;
        double r363629 = y;
        double r363630 = r363628 * r363629;
        double r363631 = r363630 * r363629;
        double r363632 = r363627 + r363631;
        return r363632;
}

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.2
Target0.1
Herbie0.1
\[x \cdot x + y \cdot \left(y + \left(y + y\right)\right)\]

Derivation

  1. Initial program 0.2

    \[\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y\]
  2. Using strategy rm
  3. Applied associate-+l+0.1

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

    \[\leadsto \left(x \cdot x + \color{blue}{y \cdot \left(y + y\right)}\right) + y \cdot y\]
  5. Using strategy rm
  6. Applied associate-+l+0.1

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

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

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

Reproduce

herbie shell --seed 2019291 
(FPCore (x y)
  :name "Linear.Quaternion:$c/ from linear-1.19.1.3, E"
  :precision binary64

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

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