Average Error: 10.4 → 0.3
Time: 9.2s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[\left(\left(y \cdot 3\right) \cdot x\right) \cdot x\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\left(\left(y \cdot 3\right) \cdot x\right) \cdot x
double f(double x, double y) {
        double r866294 = x;
        double r866295 = 3.0;
        double r866296 = r866294 * r866295;
        double r866297 = r866296 * r866294;
        double r866298 = y;
        double r866299 = r866297 * r866298;
        return r866299;
}

double f(double x, double y) {
        double r866300 = y;
        double r866301 = 3.0;
        double r866302 = r866300 * r866301;
        double r866303 = x;
        double r866304 = r866302 * r866303;
        double r866305 = r866304 * r866303;
        return r866305;
}

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

    \[\leadsto x \cdot \left(\color{blue}{\left(1 \cdot 3\right)} \cdot \left(x \cdot y\right)\right)\]
  8. Applied associate-*l*0.2

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

    \[\leadsto x \cdot \left(1 \cdot \color{blue}{\left(y \cdot \left(3 \cdot x\right)\right)}\right)\]
  10. Using strategy rm
  11. Applied associate-*r*0.3

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

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

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))