Average Error: 9.8 → 0.3
Time: 13.3s
Precision: 64
\[\left(\left(x \cdot 3.0\right) \cdot x\right) \cdot y\]
\[\left(\left(y \cdot 3.0\right) \cdot x\right) \cdot x\]
\left(\left(x \cdot 3.0\right) \cdot x\right) \cdot y
\left(\left(y \cdot 3.0\right) \cdot x\right) \cdot x
double f(double x, double y) {
        double r43101249 = x;
        double r43101250 = 3.0;
        double r43101251 = r43101249 * r43101250;
        double r43101252 = r43101251 * r43101249;
        double r43101253 = y;
        double r43101254 = r43101252 * r43101253;
        return r43101254;
}

double f(double x, double y) {
        double r43101255 = y;
        double r43101256 = 3.0;
        double r43101257 = r43101255 * r43101256;
        double r43101258 = x;
        double r43101259 = r43101257 * r43101258;
        double r43101260 = r43101259 * r43101258;
        return r43101260;
}

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.0\right) \cdot \left(x \cdot y\right)\]

Derivation

  1. Initial program 9.8

    \[\left(\left(x \cdot 3.0\right) \cdot x\right) \cdot y\]
  2. Taylor expanded around 0 9.8

    \[\leadsto \color{blue}{3.0 \cdot \left({x}^{2} \cdot y\right)}\]
  3. Simplified0.2

    \[\leadsto \color{blue}{\left(y \cdot \left(x \cdot 3.0\right)\right) \cdot x}\]
  4. Taylor expanded around 0 0.2

    \[\leadsto \color{blue}{\left(3.0 \cdot \left(x \cdot y\right)\right)} \cdot x\]
  5. Using strategy rm
  6. Applied *-un-lft-identity0.2

    \[\leadsto \left(3.0 \cdot \left(x \cdot y\right)\right) \cdot \color{blue}{\left(1 \cdot x\right)}\]
  7. Applied associate-*r*0.2

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

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

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

Reproduce

herbie shell --seed 2019158 
(FPCore (x y)
  :name "Diagrams.Segment:$catParam from diagrams-lib-1.3.0.3, A"

  :herbie-target
  (* (* x 3.0) (* x y))

  (* (* (* x 3.0) x) y))