Average Error: 10.3 → 0.3
Time: 6.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 r618753 = x;
        double r618754 = 3.0;
        double r618755 = r618753 * r618754;
        double r618756 = r618755 * r618753;
        double r618757 = y;
        double r618758 = r618756 * r618757;
        return r618758;
}

double f(double x, double y) {
        double r618759 = y;
        double r618760 = 3.0;
        double r618761 = r618759 * r618760;
        double r618762 = x;
        double r618763 = r618761 * r618762;
        double r618764 = r618763 * r618762;
        return r618764;
}

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. Using strategy rm
  5. Applied associate-*l*0.3

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

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

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

Reproduce

herbie shell --seed 2019194 +o rules:numerics
(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))