Average Error: 10.4 → 0.2
Time: 27.7s
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 r33178163 = x;
        double r33178164 = 3.0;
        double r33178165 = r33178163 * r33178164;
        double r33178166 = r33178165 * r33178163;
        double r33178167 = y;
        double r33178168 = r33178166 * r33178167;
        return r33178168;
}

double f(double x, double y) {
        double r33178169 = y;
        double r33178170 = x;
        double r33178171 = r33178169 * r33178170;
        double r33178172 = 3.0;
        double r33178173 = r33178170 * r33178172;
        double r33178174 = r33178171 * r33178173;
        return r33178174;
}

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 2019168 +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))