Average Error: 0.1 → 0.1
Time: 2.7s
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 r694415 = x;
        double r694416 = r694415 * r694415;
        double r694417 = y;
        double r694418 = r694417 * r694417;
        double r694419 = r694416 + r694418;
        double r694420 = r694419 + r694418;
        double r694421 = r694420 + r694418;
        return r694421;
}

double f(double x, double y) {
        double r694422 = x;
        double r694423 = r694422 * r694422;
        double r694424 = 3.0;
        double r694425 = y;
        double r694426 = r694424 * r694425;
        double r694427 = r694426 * r694425;
        double r694428 = r694423 + r694427;
        return r694428;
}

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

Derivation

  1. Initial program 0.1

    \[\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 2020025 
(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)))