Average Error: 10.7 → 0.3
Time: 8.2s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[x \cdot \left(\left(3 \cdot y\right) \cdot x\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
x \cdot \left(\left(3 \cdot y\right) \cdot x\right)
double f(double x, double y) {
        double r30943700 = x;
        double r30943701 = 3.0;
        double r30943702 = r30943700 * r30943701;
        double r30943703 = r30943702 * r30943700;
        double r30943704 = y;
        double r30943705 = r30943703 * r30943704;
        return r30943705;
}

double f(double x, double y) {
        double r30943706 = x;
        double r30943707 = 3.0;
        double r30943708 = y;
        double r30943709 = r30943707 * r30943708;
        double r30943710 = r30943709 * r30943706;
        double r30943711 = r30943706 * r30943710;
        return r30943711;
}

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

Derivation

  1. Initial program 10.7

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

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

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

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

Reproduce

herbie shell --seed 2019171 +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))