Average Error: 10.4 → 0.3
Time: 9.9s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(x \cdot \left(3 \cdot y\right)\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(x \cdot \left(3 \cdot y\right)\right)
double f(double x, double y) {
        double r816943 = x;
        double r816944 = 3.0;
        double r816945 = r816943 * r816944;
        double r816946 = r816945 * r816943;
        double r816947 = y;
        double r816948 = r816946 * r816947;
        return r816948;
}

double f(double x, double y) {
        double r816949 = x;
        double r816950 = 3.0;
        double r816951 = y;
        double r816952 = r816950 * r816951;
        double r816953 = r816949 * r816952;
        double r816954 = r816949 * r816953;
        return r816954;
}

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

Derivation

  1. Initial program 10.4

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

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

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

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

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

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

Reproduce

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