Average Error: 0.3 → 0.2
Time: 22.7s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot y\right) \cdot y\]
\[\left(y \cdot x\right) \cdot \left(3 \cdot y\right)\]
\left(\left(x \cdot 3\right) \cdot y\right) \cdot y
\left(y \cdot x\right) \cdot \left(3 \cdot y\right)
double f(double x, double y) {
        double r599715 = x;
        double r599716 = 3.0;
        double r599717 = r599715 * r599716;
        double r599718 = y;
        double r599719 = r599717 * r599718;
        double r599720 = r599719 * r599718;
        return r599720;
}

double f(double x, double y) {
        double r599721 = y;
        double r599722 = x;
        double r599723 = r599721 * r599722;
        double r599724 = 3.0;
        double r599725 = r599724 * r599721;
        double r599726 = r599723 * r599725;
        return r599726;
}

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.2
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.2

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019306 
(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))