Average Error: 0.1 → 0.1
Time: 3.0s
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 r341768 = x;
        double r341769 = r341768 * r341768;
        double r341770 = y;
        double r341771 = r341770 * r341770;
        double r341772 = r341769 + r341771;
        double r341773 = r341772 + r341771;
        double r341774 = r341773 + r341771;
        return r341774;
}

double f(double x, double y) {
        double r341775 = 3.0;
        double r341776 = y;
        double r341777 = r341776 * r341776;
        double r341778 = r341775 * r341777;
        double r341779 = x;
        double r341780 = r341779 * r341779;
        double r341781 = r341778 + r341780;
        return r341781;
}

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