Average Error: 10.4 → 0.2
Time: 7.1s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[\left(y \cdot x\right) \cdot \left(x \cdot 3\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\left(y \cdot x\right) \cdot \left(x \cdot 3\right)
double f(double x, double y) {
        double r452316 = x;
        double r452317 = 3.0;
        double r452318 = r452316 * r452317;
        double r452319 = r452318 * r452316;
        double r452320 = y;
        double r452321 = r452319 * r452320;
        return r452321;
}

double f(double x, double y) {
        double r452322 = y;
        double r452323 = x;
        double r452324 = r452322 * r452323;
        double r452325 = 3.0;
        double r452326 = r452323 * r452325;
        double r452327 = r452324 * r452326;
        return r452327;
}

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. Final simplification0.2

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

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(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))