Average Error: 9.9 → 0.2
Time: 13.2s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[\left(y \cdot x\right) \cdot \left(x \cdot 3\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\left(y \cdot x\right) \cdot \left(x \cdot 3\right)
double f(double x, double y) {
        double r31768938 = x;
        double r31768939 = 3.0;
        double r31768940 = r31768938 * r31768939;
        double r31768941 = r31768940 * r31768938;
        double r31768942 = y;
        double r31768943 = r31768941 * r31768942;
        return r31768943;
}

double f(double x, double y) {
        double r31768944 = y;
        double r31768945 = x;
        double r31768946 = r31768944 * r31768945;
        double r31768947 = 3.0;
        double r31768948 = r31768945 * r31768947;
        double r31768949 = r31768946 * r31768948;
        return r31768949;
}

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

Derivation

  1. Initial program 9.9

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

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

Reproduce

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