Average Error: 9.7 → 0.3
Time: 13.5s
Precision: 64
\[\left(\left(x \cdot 3.0\right) \cdot x\right) \cdot y\]
\[\left(\left(x \cdot y\right) \cdot 3.0\right) \cdot x\]
\left(\left(x \cdot 3.0\right) \cdot x\right) \cdot y
\left(\left(x \cdot y\right) \cdot 3.0\right) \cdot x
double f(double x, double y) {
        double r33282704 = x;
        double r33282705 = 3.0;
        double r33282706 = r33282704 * r33282705;
        double r33282707 = r33282706 * r33282704;
        double r33282708 = y;
        double r33282709 = r33282707 * r33282708;
        return r33282709;
}

double f(double x, double y) {
        double r33282710 = x;
        double r33282711 = y;
        double r33282712 = r33282710 * r33282711;
        double r33282713 = 3.0;
        double r33282714 = r33282712 * r33282713;
        double r33282715 = r33282714 * r33282710;
        return r33282715;
}

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

Derivation

  1. Initial program 9.7

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

    \[\leadsto \color{blue}{\left(x \cdot 3.0\right) \cdot \left(x \cdot y\right)}\]
  4. Using strategy rm
  5. Applied associate-*l*0.3

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

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

Reproduce

herbie shell --seed 2019162 +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))