Average Error: 10.4 → 0.3
Time: 13.7s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(\left(3 \cdot x\right) \cdot y\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(\left(3 \cdot x\right) \cdot y\right)
double f(double x, double y) {
        double r1055783 = x;
        double r1055784 = 3.0;
        double r1055785 = r1055783 * r1055784;
        double r1055786 = r1055785 * r1055783;
        double r1055787 = y;
        double r1055788 = r1055786 * r1055787;
        return r1055788;
}

double f(double x, double y) {
        double r1055789 = x;
        double r1055790 = 3.0;
        double r1055791 = r1055790 * r1055789;
        double r1055792 = y;
        double r1055793 = r1055791 * r1055792;
        double r1055794 = r1055789 * r1055793;
        return r1055794;
}

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.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.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.3

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

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

Reproduce

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