Average Error: 10.1 → 0.3
Time: 6.3s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[\left(\left(y \cdot 3\right) \cdot x\right) \cdot x\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\left(\left(y \cdot 3\right) \cdot x\right) \cdot x
double f(double x, double y) {
        double r1205029 = x;
        double r1205030 = 3.0;
        double r1205031 = r1205029 * r1205030;
        double r1205032 = r1205031 * r1205029;
        double r1205033 = y;
        double r1205034 = r1205032 * r1205033;
        return r1205034;
}

double f(double x, double y) {
        double r1205035 = y;
        double r1205036 = 3.0;
        double r1205037 = r1205035 * r1205036;
        double r1205038 = x;
        double r1205039 = r1205037 * r1205038;
        double r1205040 = r1205039 * r1205038;
        return r1205040;
}

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

Derivation

  1. Initial program 10.1

    \[\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-*l*0.3

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

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

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

Reproduce

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