Average Error: 11.0 → 0.3
Time: 2.5s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(3 \cdot \left(x \cdot y\right)\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(3 \cdot \left(x \cdot y\right)\right)
double f(double x, double y) {
        double r699332 = x;
        double r699333 = 3.0;
        double r699334 = r699332 * r699333;
        double r699335 = r699334 * r699332;
        double r699336 = y;
        double r699337 = r699335 * r699336;
        return r699337;
}

double f(double x, double y) {
        double r699338 = x;
        double r699339 = 3.0;
        double r699340 = y;
        double r699341 = r699338 * r699340;
        double r699342 = r699339 * r699341;
        double r699343 = r699338 * r699342;
        return r699343;
}

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

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

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

Reproduce

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