Average Error: 0.1 → 0.1
Time: 16.0s
Precision: 64
\[\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y\]
\[\left(\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y} + y \cdot y\right) + y \cdot y\]
\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y
\left(\sqrt{x \cdot x + y \cdot y} \cdot \sqrt{x \cdot x + y \cdot y} + y \cdot y\right) + y \cdot y
double f(double x, double y) {
        double r305405 = x;
        double r305406 = r305405 * r305405;
        double r305407 = y;
        double r305408 = r305407 * r305407;
        double r305409 = r305406 + r305408;
        double r305410 = r305409 + r305408;
        double r305411 = r305410 + r305408;
        return r305411;
}

double f(double x, double y) {
        double r305412 = x;
        double r305413 = r305412 * r305412;
        double r305414 = y;
        double r305415 = r305414 * r305414;
        double r305416 = r305413 + r305415;
        double r305417 = sqrt(r305416);
        double r305418 = r305417 * r305417;
        double r305419 = r305418 + r305415;
        double r305420 = r305419 + r305415;
        return r305420;
}

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. Final simplification0.1

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

Reproduce

herbie shell --seed 2019323 
(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)))