Average Error: 10.2 → 0.2
Time: 14.1s
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 r773106 = x;
        double r773107 = 3.0;
        double r773108 = r773106 * r773107;
        double r773109 = r773108 * r773106;
        double r773110 = y;
        double r773111 = r773109 * r773110;
        return r773111;
}

double f(double x, double y) {
        double r773112 = x;
        double r773113 = 3.0;
        double r773114 = y;
        double r773115 = r773114 * r773112;
        double r773116 = r773113 * r773115;
        double r773117 = r773112 * r773116;
        return r773117;
}

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

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

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

Reproduce

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