Average Error: 10.4 → 0.2
Time: 1.6s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(\left(x \cdot y\right) \cdot 3\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(\left(x \cdot y\right) \cdot 3\right)
double f(double x, double y) {
        double r828080 = x;
        double r828081 = 3.0;
        double r828082 = r828080 * r828081;
        double r828083 = r828082 * r828080;
        double r828084 = y;
        double r828085 = r828083 * r828084;
        return r828085;
}

double f(double x, double y) {
        double r828086 = x;
        double r828087 = y;
        double r828088 = r828086 * r828087;
        double r828089 = 3.0;
        double r828090 = r828088 * r828089;
        double r828091 = r828086 * r828090;
        return r828091;
}

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

    \[\leadsto \color{blue}{x \cdot \left(3 \cdot \left(x \cdot y\right)\right)}\]
  6. Using strategy rm
  7. Applied *-commutative0.2

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

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

Reproduce

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

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

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