Average Error: 10.2 → 0.3
Time: 5.8s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(3 \cdot \left(y \cdot x\right)\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(3 \cdot \left(y \cdot x\right)\right)
double f(double x, double y) {
        double r827193 = x;
        double r827194 = 3.0;
        double r827195 = r827193 * r827194;
        double r827196 = r827195 * r827193;
        double r827197 = y;
        double r827198 = r827196 * r827197;
        return r827198;
}

double f(double x, double y) {
        double r827199 = x;
        double r827200 = 3.0;
        double r827201 = y;
        double r827202 = r827201 * r827199;
        double r827203 = r827200 * r827202;
        double r827204 = r827199 * r827203;
        return r827204;
}

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

Derivation

  1. Initial program 10.2

    \[\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-*l*0.3

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

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

Reproduce

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