Average Error: 10.5 → 0.2
Time: 1.8s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(3 \cdot \left(x \cdot y\right)\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(3 \cdot \left(x \cdot y\right)\right)
double f(double x, double y) {
        double r897888 = x;
        double r897889 = 3.0;
        double r897890 = r897888 * r897889;
        double r897891 = r897890 * r897888;
        double r897892 = y;
        double r897893 = r897891 * r897892;
        return r897893;
}

double f(double x, double y) {
        double r897894 = x;
        double r897895 = 3.0;
        double r897896 = y;
        double r897897 = r897894 * r897896;
        double r897898 = r897895 * r897897;
        double r897899 = r897894 * r897898;
        return r897899;
}

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

Derivation

  1. Initial program 10.5

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

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

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

Reproduce

herbie shell --seed 2020089 
(FPCore (x y)
  :name "Diagrams.Segment:$catParam from diagrams-lib-1.3.0.3, A"
  :precision binary64

  :herbie-target
  (* (* x 3) (* x y))

  (* (* (* x 3) x) y))