Average Error: 0.1 → 0.1
Time: 14.0s
Precision: 64
\[\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y\]
\[\left(y \cdot 3\right) \cdot y + x \cdot x\]
\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y
\left(y \cdot 3\right) \cdot y + x \cdot x
double f(double x, double y) {
        double r95673429 = x;
        double r95673430 = r95673429 * r95673429;
        double r95673431 = y;
        double r95673432 = r95673431 * r95673431;
        double r95673433 = r95673430 + r95673432;
        double r95673434 = r95673433 + r95673432;
        double r95673435 = r95673434 + r95673432;
        return r95673435;
}

double f(double x, double y) {
        double r95673436 = y;
        double r95673437 = 3.0;
        double r95673438 = r95673436 * r95673437;
        double r95673439 = r95673438 * r95673436;
        double r95673440 = x;
        double r95673441 = r95673440 * r95673440;
        double r95673442 = r95673439 + r95673441;
        return r95673442;
}

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. Simplified0.1

    \[\leadsto \color{blue}{3 \cdot \left(y \cdot y\right) + x \cdot x}\]
  3. Using strategy rm
  4. Applied associate-*r*0.1

    \[\leadsto \color{blue}{\left(3 \cdot y\right) \cdot y} + x \cdot x\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt0.3

    \[\leadsto \color{blue}{\sqrt{\left(3 \cdot y\right) \cdot y} \cdot \sqrt{\left(3 \cdot y\right) \cdot y}} + x \cdot x\]
  7. Using strategy rm
  8. Applied sqrt-prod32.1

    \[\leadsto \sqrt{\left(3 \cdot y\right) \cdot y} \cdot \color{blue}{\left(\sqrt{3 \cdot y} \cdot \sqrt{y}\right)} + x \cdot x\]
  9. Applied sqrt-prod32.2

    \[\leadsto \color{blue}{\left(\sqrt{3 \cdot y} \cdot \sqrt{y}\right)} \cdot \left(\sqrt{3 \cdot y} \cdot \sqrt{y}\right) + x \cdot x\]
  10. Applied swap-sqr32.2

    \[\leadsto \color{blue}{\left(\sqrt{3 \cdot y} \cdot \sqrt{3 \cdot y}\right) \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)} + x \cdot x\]
  11. Simplified32.2

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

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

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

Reproduce

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

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

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