Average Error: 10.1 → 0.3
Time: 6.5s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[\left(x \cdot \left(x \cdot y\right)\right) \cdot 3\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\left(x \cdot \left(x \cdot y\right)\right) \cdot 3
double f(double x, double y) {
        double r38941143 = x;
        double r38941144 = 3.0;
        double r38941145 = r38941143 * r38941144;
        double r38941146 = r38941145 * r38941143;
        double r38941147 = y;
        double r38941148 = r38941146 * r38941147;
        return r38941148;
}

double f(double x, double y) {
        double r38941149 = x;
        double r38941150 = y;
        double r38941151 = r38941149 * r38941150;
        double r38941152 = r38941149 * r38941151;
        double r38941153 = 3.0;
        double r38941154 = r38941152 * r38941153;
        return r38941154;
}

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. Taylor expanded around 0 10.1

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

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

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

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))