Average Error: 10.1 → 0.3
Time: 8.1s
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 r32036743 = x;
        double r32036744 = 3.0;
        double r32036745 = r32036743 * r32036744;
        double r32036746 = r32036745 * r32036743;
        double r32036747 = y;
        double r32036748 = r32036746 * r32036747;
        return r32036748;
}

double f(double x, double y) {
        double r32036749 = x;
        double r32036750 = y;
        double r32036751 = r32036749 * r32036750;
        double r32036752 = r32036749 * r32036751;
        double r32036753 = 3.0;
        double r32036754 = r32036752 * r32036753;
        return r32036754;
}

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(\left(3 \cdot y\right) \cdot x\right) \cdot x}\]
  6. Using strategy rm
  7. Applied associate-*l*0.3

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

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

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

Reproduce

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