Average Error: 10.4 → 0.3
Time: 24.3s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[3 \cdot \left(\left(x \cdot y\right) \cdot x\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
3 \cdot \left(\left(x \cdot y\right) \cdot x\right)
double f(double x, double y) {
        double r504541 = x;
        double r504542 = 3.0;
        double r504543 = r504541 * r504542;
        double r504544 = r504543 * r504541;
        double r504545 = y;
        double r504546 = r504544 * r504545;
        return r504546;
}

double f(double x, double y) {
        double r504547 = 3.0;
        double r504548 = x;
        double r504549 = y;
        double r504550 = r504548 * r504549;
        double r504551 = r504550 * r504548;
        double r504552 = r504547 * r504551;
        return r504552;
}

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.3
Herbie0.3
\[\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.3

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

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

    \[\leadsto \color{blue}{\left(3 \cdot \left(x \cdot y\right)\right) \cdot x}\]
  8. Using strategy rm
  9. Applied associate-*l*0.3

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

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

Reproduce

herbie shell --seed 2019326 +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))