Average Error: 10.6 → 0.3
Time: 7.6s
Precision: 64
\[\left(\left(x \cdot 3\right) \cdot x\right) \cdot y\]
\[\left(3 \cdot x\right) \cdot \left(x \cdot y\right)\]
\left(\left(x \cdot 3\right) \cdot x\right) \cdot y
\left(3 \cdot x\right) \cdot \left(x \cdot y\right)
double f(double x, double y) {
        double r812928 = x;
        double r812929 = 3.0;
        double r812930 = r812928 * r812929;
        double r812931 = r812930 * r812928;
        double r812932 = y;
        double r812933 = r812931 * r812932;
        return r812933;
}

double f(double x, double y) {
        double r812934 = 3.0;
        double r812935 = x;
        double r812936 = r812934 * r812935;
        double r812937 = y;
        double r812938 = r812935 * r812937;
        double r812939 = r812936 * r812938;
        return r812939;
}

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

Derivation

  1. Initial program 10.6

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

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

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

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

    \[\leadsto x \cdot \color{blue}{\left(\left(x \cdot 3\right) \cdot y\right)}\]
  8. Using strategy rm
  9. Applied pow10.2

    \[\leadsto x \cdot \left(\left(x \cdot 3\right) \cdot \color{blue}{{y}^{1}}\right)\]
  10. Applied pow10.2

    \[\leadsto x \cdot \left(\left(x \cdot \color{blue}{{3}^{1}}\right) \cdot {y}^{1}\right)\]
  11. Applied pow10.2

    \[\leadsto x \cdot \left(\left(\color{blue}{{x}^{1}} \cdot {3}^{1}\right) \cdot {y}^{1}\right)\]
  12. Applied pow-prod-down0.2

    \[\leadsto x \cdot \left(\color{blue}{{\left(x \cdot 3\right)}^{1}} \cdot {y}^{1}\right)\]
  13. Applied pow-prod-down0.2

    \[\leadsto x \cdot \color{blue}{{\left(\left(x \cdot 3\right) \cdot y\right)}^{1}}\]
  14. Applied pow10.2

    \[\leadsto \color{blue}{{x}^{1}} \cdot {\left(\left(x \cdot 3\right) \cdot y\right)}^{1}\]
  15. Applied pow-prod-down0.2

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

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

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

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

Reproduce

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