Average Error: 0.3 → 0.2
Time: 6.3s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot y\right) \cdot y\]
\[\left(y \cdot 3\right) \cdot \left(x \cdot y\right)\]
\left(\left(x \cdot 3\right) \cdot y\right) \cdot y
\left(y \cdot 3\right) \cdot \left(x \cdot y\right)
double f(double x, double y) {
        double r500337 = x;
        double r500338 = 3.0;
        double r500339 = r500337 * r500338;
        double r500340 = y;
        double r500341 = r500339 * r500340;
        double r500342 = r500341 * r500340;
        return r500342;
}

double f(double x, double y) {
        double r500343 = y;
        double r500344 = 3.0;
        double r500345 = r500343 * r500344;
        double r500346 = x;
        double r500347 = r500346 * r500343;
        double r500348 = r500345 * r500347;
        return r500348;
}

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.3
Target0.2
Herbie0.2
\[\left(x \cdot \left(3 \cdot y\right)\right) \cdot y\]

Derivation

  1. Initial program 0.3

    \[\left(\left(x \cdot 3\right) \cdot y\right) \cdot y\]
  2. Taylor expanded around 0 11.0

    \[\leadsto \color{blue}{3 \cdot \left(x \cdot {y}^{2}\right)}\]
  3. Simplified0.2

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

    \[\leadsto \color{blue}{\left(y \cdot 3\right) \cdot \left(x \cdot y\right)}\]
  6. Final simplification0.2

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

Reproduce

herbie shell --seed 2019208 
(FPCore (x y)
  :name "Diagrams.Segment:$catParam from diagrams-lib-1.3.0.3, B"
  :precision binary64

  :herbie-target
  (* (* x (* 3 y)) y)

  (* (* (* x 3) y) y))