Average Error: 11.0 → 0.2
Time: 10.3s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(\left(3 \cdot x\right) \cdot y\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(\left(3 \cdot x\right) \cdot y\right)
double f(double x, double y) {
        double r877349 = x;
        double r877350 = 3.0;
        double r877351 = r877349 * r877350;
        double r877352 = r877351 * r877349;
        double r877353 = y;
        double r877354 = r877352 * r877353;
        return r877354;
}

double f(double x, double y) {
        double r877355 = x;
        double r877356 = 3.0;
        double r877357 = r877356 * r877355;
        double r877358 = y;
        double r877359 = r877357 * r877358;
        double r877360 = r877355 * r877359;
        return r877360;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.0
Target0.3
Herbie0.2
\[\left(x \cdot 3\right) \cdot \left(x \cdot y\right)\]

Derivation

  1. Initial program 11.0

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

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

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

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

Reproduce

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