Average Error: 10.3 → 0.2
Time: 15.8s
Precision: 64
\[\left(\left(x \cdot 3.0\right) \cdot x\right) \cdot y\]
\[\left(y \cdot x\right) \cdot \left(x \cdot 3.0\right)\]
\left(\left(x \cdot 3.0\right) \cdot x\right) \cdot y
\left(y \cdot x\right) \cdot \left(x \cdot 3.0\right)
double f(double x, double y) {
        double r34118917 = x;
        double r34118918 = 3.0;
        double r34118919 = r34118917 * r34118918;
        double r34118920 = r34118919 * r34118917;
        double r34118921 = y;
        double r34118922 = r34118920 * r34118921;
        return r34118922;
}

double f(double x, double y) {
        double r34118923 = y;
        double r34118924 = x;
        double r34118925 = r34118923 * r34118924;
        double r34118926 = 3.0;
        double r34118927 = r34118924 * r34118926;
        double r34118928 = r34118925 * r34118927;
        return r34118928;
}

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

Derivation

  1. Initial program 10.3

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

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

Reproduce

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