Average Error: 10.3 → 0.2
Time: 7.2s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(\left(y \cdot x\right) \cdot 3\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(\left(y \cdot x\right) \cdot 3\right)
double f(double x, double y) {
        double r618929 = x;
        double r618930 = 3.0;
        double r618931 = r618929 * r618930;
        double r618932 = r618931 * r618929;
        double r618933 = y;
        double r618934 = r618932 * r618933;
        return r618934;
}

double f(double x, double y) {
        double r618935 = x;
        double r618936 = y;
        double r618937 = r618936 * r618935;
        double r618938 = 3.0;
        double r618939 = r618937 * r618938;
        double r618940 = r618935 * r618939;
        return r618940;
}

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

Derivation

  1. Initial program 10.3

    \[\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. Simplified0.2

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

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

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

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

Reproduce

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