Average Error: 0.3 → 0.2
Time: 6.9s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot y\right) \cdot y\]
\[\left(\left(y \cdot x\right) \cdot 3\right) \cdot y\]
\left(\left(x \cdot 3\right) \cdot y\right) \cdot y
\left(\left(y \cdot x\right) \cdot 3\right) \cdot y
double f(double x, double y) {
        double r538336 = x;
        double r538337 = 3.0;
        double r538338 = r538336 * r538337;
        double r538339 = y;
        double r538340 = r538338 * r538339;
        double r538341 = r538340 * r538339;
        return r538341;
}

double f(double x, double y) {
        double r538342 = y;
        double r538343 = x;
        double r538344 = r538342 * r538343;
        double r538345 = 3.0;
        double r538346 = r538344 * r538345;
        double r538347 = r538346 * r538342;
        return r538347;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 0.3

    \[\left(\left(x \cdot 3\right) \cdot y\right) \cdot y\]
  2. Simplified0.2

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

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

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

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

Reproduce

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

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

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