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\]
\[\left(3 \cdot y\right) \cdot y + x \cdot x\]
\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y
\left(3 \cdot y\right) \cdot y + x \cdot x
double f(double x, double y) {
        double r495730 = x;
        double r495731 = r495730 * r495730;
        double r495732 = y;
        double r495733 = r495732 * r495732;
        double r495734 = r495731 + r495733;
        double r495735 = r495734 + r495733;
        double r495736 = r495735 + r495733;
        return r495736;
}

double f(double x, double y) {
        double r495737 = 3.0;
        double r495738 = y;
        double r495739 = r495737 * r495738;
        double r495740 = r495739 * r495738;
        double r495741 = x;
        double r495742 = r495741 * r495741;
        double r495743 = r495740 + r495742;
        return r495743;
}

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. Using strategy rm
  4. Applied *-un-lft-identity0.1

    \[\leadsto \color{blue}{1 \cdot \left(3 \cdot \left(y \cdot y\right) + x \cdot x\right)}\]
  5. Using strategy rm
  6. Applied associate-*r*0.1

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

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

Reproduce

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