Average Error: 10.4 → 0.3
Time: 5.8s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[\left(\left(x \cdot y\right) \cdot 3\right) \cdot x\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\left(\left(x \cdot y\right) \cdot 3\right) \cdot x
double f(double x, double y) {
        double r615393 = x;
        double r615394 = 3.0;
        double r615395 = r615393 * r615394;
        double r615396 = r615395 * r615393;
        double r615397 = y;
        double r615398 = r615396 * r615397;
        return r615398;
}

double f(double x, double y) {
        double r615399 = x;
        double r615400 = y;
        double r615401 = r615399 * r615400;
        double r615402 = 3.0;
        double r615403 = r615401 * r615402;
        double r615404 = r615403 * r615399;
        return r615404;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.4
Target0.2
Herbie0.3
\[\left(x \cdot 3\right) \cdot \left(x \cdot y\right)\]

Derivation

  1. Initial program 10.4

    \[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
  2. Simplified10.4

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

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

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

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

Reproduce

herbie shell --seed 2019174 
(FPCore (x y)
  :name "Diagrams.Segment:$catParam from diagrams-lib-1.3.0.3, A"

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

  (* (* (* x 3.0) x) y))