Average Error: 10.4 → 0.2
Time: 1.6s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(3 \cdot \left(x \cdot y\right)\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(3 \cdot \left(x \cdot y\right)\right)
double f(double x, double y) {
        double r802909 = x;
        double r802910 = 3.0;
        double r802911 = r802909 * r802910;
        double r802912 = r802911 * r802909;
        double r802913 = y;
        double r802914 = r802912 * r802913;
        return r802914;
}

double f(double x, double y) {
        double r802915 = x;
        double r802916 = 3.0;
        double r802917 = y;
        double r802918 = r802915 * r802917;
        double r802919 = r802916 * r802918;
        double r802920 = r802915 * r802919;
        return r802920;
}

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.2
\[\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 *-un-lft-identity0.2

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

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

Reproduce

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