Average Error: 0.1 → 0.1
Time: 17.4s
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 r334985 = x;
        double r334986 = r334985 * r334985;
        double r334987 = y;
        double r334988 = r334987 * r334987;
        double r334989 = r334986 + r334988;
        double r334990 = r334989 + r334988;
        double r334991 = r334990 + r334988;
        return r334991;
}

double f(double x, double y) {
        double r334992 = x;
        double r334993 = r334992 * r334992;
        double r334994 = y;
        double r334995 = r334994 * r334994;
        double r334996 = r334993 + r334995;
        double r334997 = sqrt(r334996);
        double r334998 = r334997 * r334997;
        double r334999 = r334998 + r334995;
        double r335000 = r334999 + r334995;
        return r335000;
}

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)))