Average Error: 10.4 → 0.3
Time: 12.0s
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 r36486562 = x;
        double r36486563 = 3.0;
        double r36486564 = r36486562 * r36486563;
        double r36486565 = r36486564 * r36486562;
        double r36486566 = y;
        double r36486567 = r36486565 * r36486566;
        return r36486567;
}

double f(double x, double y) {
        double r36486568 = x;
        double r36486569 = y;
        double r36486570 = r36486568 * r36486569;
        double r36486571 = 3.0;
        double r36486572 = r36486570 * r36486571;
        double r36486573 = r36486572 * r36486568;
        return r36486573;
}

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.3
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.3

    \[\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 2019170 
(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))