Average Error: 0.1 → 0.1
Time: 4.7s
Precision: 64
\[\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y\]
\[\left(\mathsf{hypot}\left(x, y\right) \cdot \mathsf{hypot}\left(x, y\right) + y \cdot y\right) + y \cdot y\]
\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y
\left(\mathsf{hypot}\left(x, y\right) \cdot \mathsf{hypot}\left(x, y\right) + y \cdot y\right) + y \cdot y
double f(double x, double y) {
        double r471612 = x;
        double r471613 = r471612 * r471612;
        double r471614 = y;
        double r471615 = r471614 * r471614;
        double r471616 = r471613 + r471615;
        double r471617 = r471616 + r471615;
        double r471618 = r471617 + r471615;
        return r471618;
}

double f(double x, double y) {
        double r471619 = x;
        double r471620 = y;
        double r471621 = hypot(r471619, r471620);
        double r471622 = r471621 * r471621;
        double r471623 = r471620 * r471620;
        double r471624 = r471622 + r471623;
        double r471625 = r471624 + r471623;
        return r471625;
}

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 add-sqr-sqrt0.1

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

    \[\leadsto \left(\color{blue}{\mathsf{hypot}\left(x, y\right)} \cdot \sqrt{x \cdot x + y \cdot y} + y \cdot y\right) + y \cdot y\]
  5. Simplified0.1

    \[\leadsto \left(\mathsf{hypot}\left(x, y\right) \cdot \color{blue}{\mathsf{hypot}\left(x, y\right)} + y \cdot y\right) + y \cdot y\]
  6. Final simplification0.1

    \[\leadsto \left(\mathsf{hypot}\left(x, y\right) \cdot \mathsf{hypot}\left(x, y\right) + y \cdot y\right) + y \cdot y\]

Reproduce

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