Average Error: 10.2 → 0.2
Time: 7.0s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[\left(3 \cdot \left(y \cdot x\right)\right) \cdot x\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\left(3 \cdot \left(y \cdot x\right)\right) \cdot x
double f(double x, double y) {
        double r495143 = x;
        double r495144 = 3.0;
        double r495145 = r495143 * r495144;
        double r495146 = r495145 * r495143;
        double r495147 = y;
        double r495148 = r495146 * r495147;
        return r495148;
}

double f(double x, double y) {
        double r495149 = 3.0;
        double r495150 = y;
        double r495151 = x;
        double r495152 = r495150 * r495151;
        double r495153 = r495149 * r495152;
        double r495154 = r495153 * r495151;
        return r495154;
}

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

Derivation

  1. Initial program 10.2

    \[\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-*r*0.3

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

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

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

Reproduce

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