Average Error: 10.5 → 0.3
Time: 18.9s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(\left(3 \cdot y\right) \cdot x\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(\left(3 \cdot y\right) \cdot x\right)
double f(double x, double y) {
        double r549501 = x;
        double r549502 = 3.0;
        double r549503 = r549501 * r549502;
        double r549504 = r549503 * r549501;
        double r549505 = y;
        double r549506 = r549504 * r549505;
        return r549506;
}

double f(double x, double y) {
        double r549507 = x;
        double r549508 = 3.0;
        double r549509 = y;
        double r549510 = r549508 * r549509;
        double r549511 = r549510 * r549507;
        double r549512 = r549507 * r549511;
        return r549512;
}

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

Derivation

  1. Initial program 10.5

    \[\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. Using strategy rm
  8. Applied associate-*r*0.3

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

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

Reproduce

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