Average Error: 0.1 → 0.1
Time: 2.6s
Precision: 64
\[\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y\]
\[3 \cdot \left(y \cdot y\right) + x \cdot x\]
\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y
3 \cdot \left(y \cdot y\right) + x \cdot x
double f(double x, double y) {
        double r563958 = x;
        double r563959 = r563958 * r563958;
        double r563960 = y;
        double r563961 = r563960 * r563960;
        double r563962 = r563959 + r563961;
        double r563963 = r563962 + r563961;
        double r563964 = r563963 + r563961;
        return r563964;
}

double f(double x, double y) {
        double r563965 = 3.0;
        double r563966 = y;
        double r563967 = r563966 * r563966;
        double r563968 = r563965 * r563967;
        double r563969 = x;
        double r563970 = r563969 * r563969;
        double r563971 = r563968 + r563970;
        return r563971;
}

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

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

Reproduce

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