Average Error: 10.4 → 0.3
Time: 7.1s
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 r36436115 = x;
        double r36436116 = 3.0;
        double r36436117 = r36436115 * r36436116;
        double r36436118 = r36436117 * r36436115;
        double r36436119 = y;
        double r36436120 = r36436118 * r36436119;
        return r36436120;
}

double f(double x, double y) {
        double r36436121 = x;
        double r36436122 = y;
        double r36436123 = r36436121 * r36436122;
        double r36436124 = 3.0;
        double r36436125 = r36436123 * r36436124;
        double r36436126 = r36436125 * r36436121;
        return r36436126;
}

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. Using strategy rm
  3. Applied associate-*l*0.2

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

    \[\leadsto \color{blue}{x \cdot \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))