Average Error: 10.4 → 0.3
Time: 19.3s
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 r472139 = x;
        double r472140 = 3.0;
        double r472141 = r472139 * r472140;
        double r472142 = r472141 * r472139;
        double r472143 = y;
        double r472144 = r472142 * r472143;
        return r472144;
}

double f(double x, double y) {
        double r472145 = x;
        double r472146 = 3.0;
        double r472147 = y;
        double r472148 = r472146 * r472147;
        double r472149 = r472148 * r472145;
        double r472150 = r472145 * r472149;
        return r472150;
}

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. 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 2019325 
(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))