Average Error: 10.6 → 0.2
Time: 7.9s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[\left(\left(x \cdot y\right) \cdot 3\right) \cdot x\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\left(\left(x \cdot y\right) \cdot 3\right) \cdot x
double f(double x, double y) {
        double r491481 = x;
        double r491482 = 3.0;
        double r491483 = r491481 * r491482;
        double r491484 = r491483 * r491481;
        double r491485 = y;
        double r491486 = r491484 * r491485;
        return r491486;
}

double f(double x, double y) {
        double r491487 = x;
        double r491488 = y;
        double r491489 = r491487 * r491488;
        double r491490 = 3.0;
        double r491491 = r491489 * r491490;
        double r491492 = r491491 * r491487;
        return r491492;
}

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

Derivation

  1. Initial program 10.6

    \[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
  2. Using strategy rm
  3. Applied associate-*l*0.3

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

    \[\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. Final simplification0.2

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

Reproduce

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