Average Error: 10.6 → 0.2
Time: 32.0s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[\left(y \cdot x\right) \cdot \left(x \cdot 3\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\left(y \cdot x\right) \cdot \left(x \cdot 3\right)
double f(double x, double y) {
        double r34965432 = x;
        double r34965433 = 3.0;
        double r34965434 = r34965432 * r34965433;
        double r34965435 = r34965434 * r34965432;
        double r34965436 = y;
        double r34965437 = r34965435 * r34965436;
        return r34965437;
}

double f(double x, double y) {
        double r34965438 = y;
        double r34965439 = x;
        double r34965440 = r34965438 * r34965439;
        double r34965441 = 3.0;
        double r34965442 = r34965439 * r34965441;
        double r34965443 = r34965440 * r34965442;
        return r34965443;
}

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.2
\[\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. Taylor expanded around 0 10.6

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

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

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

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

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y)
  :name "Diagrams.Segment:$catParam from diagrams-lib-1.3.0.3, A"

  :herbie-target
  (* (* x 3.0) (* x y))

  (* (* (* x 3.0) x) y))