Average Error: 0.3 → 0.2
Time: 14.8s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot y\right) \cdot y\]
\[\left(3 \cdot \left(x \cdot y\right)\right) \cdot y\]
\left(\left(x \cdot 3\right) \cdot y\right) \cdot y
\left(3 \cdot \left(x \cdot y\right)\right) \cdot y
double f(double x, double y) {
        double r786886 = x;
        double r786887 = 3.0;
        double r786888 = r786886 * r786887;
        double r786889 = y;
        double r786890 = r786888 * r786889;
        double r786891 = r786890 * r786889;
        return r786891;
}

double f(double x, double y) {
        double r786892 = 3.0;
        double r786893 = x;
        double r786894 = y;
        double r786895 = r786893 * r786894;
        double r786896 = r786892 * r786895;
        double r786897 = r786896 * r786894;
        return r786897;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.3
Target0.3
Herbie0.2
\[\left(x \cdot \left(3 \cdot y\right)\right) \cdot y\]

Derivation

  1. Initial program 0.3

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

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

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

    \[\leadsto \left(x \cdot \left(y \cdot 3\right)\right) \cdot \color{blue}{\left(1 \cdot y\right)}\]
  7. Applied associate-*r*0.3

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

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

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

Reproduce

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

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

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