Average Error: 10.4 → 0.3
Time: 24.1s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[3 \cdot \left(\left(x \cdot y\right) \cdot x\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
3 \cdot \left(\left(x \cdot y\right) \cdot x\right)
double f(double x, double y) {
        double r462184 = x;
        double r462185 = 3.0;
        double r462186 = r462184 * r462185;
        double r462187 = r462186 * r462184;
        double r462188 = y;
        double r462189 = r462187 * r462188;
        return r462189;
}

double f(double x, double y) {
        double r462190 = 3.0;
        double r462191 = x;
        double r462192 = y;
        double r462193 = r462191 * r462192;
        double r462194 = r462193 * r462191;
        double r462195 = r462190 * r462194;
        return r462195;
}

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. Using strategy rm
  7. Applied *-commutative0.3

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

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

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

Reproduce

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