Average Error: 9.8 → 0.3
Time: 6.3s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(x \cdot \left(3 \cdot y\right)\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(x \cdot \left(3 \cdot y\right)\right)
double f(double x, double y) {
        double r680107 = x;
        double r680108 = 3.0;
        double r680109 = r680107 * r680108;
        double r680110 = r680109 * r680107;
        double r680111 = y;
        double r680112 = r680110 * r680111;
        return r680112;
}

double f(double x, double y) {
        double r680113 = x;
        double r680114 = 3.0;
        double r680115 = y;
        double r680116 = r680114 * r680115;
        double r680117 = r680113 * r680116;
        double r680118 = r680113 * r680117;
        return r680118;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original9.8
Target0.2
Herbie0.3
\[\left(x \cdot 3\right) \cdot \left(x \cdot y\right)\]

Derivation

  1. Initial program 9.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. Using strategy rm
  10. Applied associate-*l*0.3

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

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

Reproduce

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