Average Error: 10.6 → 0.3
Time: 7.1s
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 r687724 = x;
        double r687725 = 3.0;
        double r687726 = r687724 * r687725;
        double r687727 = r687726 * r687724;
        double r687728 = y;
        double r687729 = r687727 * r687728;
        return r687729;
}

double f(double x, double y) {
        double r687730 = 3.0;
        double r687731 = y;
        double r687732 = x;
        double r687733 = r687731 * r687732;
        double r687734 = r687730 * r687733;
        double r687735 = r687734 * r687732;
        return r687735;
}

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

Derivation

  1. Initial program 10.6

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

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

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

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

Reproduce

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