Average Error: 10.2 → 0.2
Time: 6.2s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(\left(x \cdot 3\right) \cdot y\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(\left(x \cdot 3\right) \cdot y\right)
double f(double x, double y) {
        double r500571 = x;
        double r500572 = 3.0;
        double r500573 = r500571 * r500572;
        double r500574 = r500573 * r500571;
        double r500575 = y;
        double r500576 = r500574 * r500575;
        return r500576;
}

double f(double x, double y) {
        double r500577 = x;
        double r500578 = 3.0;
        double r500579 = r500577 * r500578;
        double r500580 = y;
        double r500581 = r500579 * r500580;
        double r500582 = r500577 * r500581;
        return r500582;
}

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.2
\[\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. 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 associate-*r*0.2

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

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

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

Reproduce

herbie shell --seed 2019298 
(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))