Average Error: 10.8 → 0.2
Time: 6.1s
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 r520645 = x;
        double r520646 = 3.0;
        double r520647 = r520645 * r520646;
        double r520648 = r520647 * r520645;
        double r520649 = y;
        double r520650 = r520648 * r520649;
        return r520650;
}

double f(double x, double y) {
        double r520651 = x;
        double r520652 = 3.0;
        double r520653 = r520651 * r520652;
        double r520654 = y;
        double r520655 = r520653 * r520654;
        double r520656 = r520651 * r520655;
        return r520656;
}

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

Derivation

  1. Initial program 10.8

    \[\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 2019297 
(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))