Average Error: 0.1 → 0.1
Time: 30.0s
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 r305023 = x;
        double r305024 = r305023 * r305023;
        double r305025 = y;
        double r305026 = r305025 * r305025;
        double r305027 = r305024 + r305026;
        double r305028 = r305027 + r305026;
        double r305029 = r305028 + r305026;
        return r305029;
}

double f(double x, double y) {
        double r305030 = x;
        double r305031 = r305030 * r305030;
        double r305032 = 3.0;
        double r305033 = y;
        double r305034 = r305032 * r305033;
        double r305035 = r305034 * r305033;
        double r305036 = r305031 + r305035;
        return r305036;
}

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}{x \cdot x + 3 \cdot \left(y \cdot y\right)}\]
  3. Using strategy rm
  4. Applied associate-*r*0.1

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

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

Reproduce

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