Average Error: 10.4 → 0.3
Time: 12.4s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[\left(\left(x \cdot y\right) \cdot 3\right) \cdot x\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\left(\left(x \cdot y\right) \cdot 3\right) \cdot x
double f(double x, double y) {
        double r38638718 = x;
        double r38638719 = 3.0;
        double r38638720 = r38638718 * r38638719;
        double r38638721 = r38638720 * r38638718;
        double r38638722 = y;
        double r38638723 = r38638721 * r38638722;
        return r38638723;
}

double f(double x, double y) {
        double r38638724 = x;
        double r38638725 = y;
        double r38638726 = r38638724 * r38638725;
        double r38638727 = 3.0;
        double r38638728 = r38638726 * r38638727;
        double r38638729 = r38638728 * r38638724;
        return r38638729;
}

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

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

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

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

Reproduce

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