Average Error: 10.3 → 0.3
Time: 6.9s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(\left(y \cdot 3\right) \cdot x\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(\left(y \cdot 3\right) \cdot x\right)
double f(double x, double y) {
        double r663719 = x;
        double r663720 = 3.0;
        double r663721 = r663719 * r663720;
        double r663722 = r663721 * r663719;
        double r663723 = y;
        double r663724 = r663722 * r663723;
        return r663724;
}

double f(double x, double y) {
        double r663725 = x;
        double r663726 = y;
        double r663727 = 3.0;
        double r663728 = r663726 * r663727;
        double r663729 = r663728 * r663725;
        double r663730 = r663725 * r663729;
        return r663730;
}

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

Derivation

  1. Initial program 10.3

    \[\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.3

    \[\leadsto \color{blue}{x \cdot \left(3 \cdot \left(y \cdot x\right)\right)}\]
  7. Using strategy rm
  8. Applied *-un-lft-identity0.3

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

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

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

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

Reproduce

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