This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/57674] New: wrong distribution for std::binomial_distribution::operator()(g,param)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57674

            Bug ID: 57674
           Summary: wrong distribution for
                    std::binomial_distribution::operator()(g,param)
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: schlaffi at users dot sourceforge.net

Created attachment 30337
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30337&action=edit
example where bindist(gen,param) fails

std::binomial_distribution::operator()(g,param) produces an invalid statistic.
It uses the old probability p_old if param.p<.5 and otherwise 1-p_old. Looks
like a typo.

That is, dist(gen,para2); gives 

distribution 1: p = 0.8, f = 0.798828
distribution 2: p = 0.3, f = 0.206055

while dist.param(para2);dist(gen); gives

distribution 1: p = 0.8, f = 0.324219
distribution 2: p = 0.3, f = 0.295898

I briefly checked the SVN, there does not seem to be a change since v2.7.8.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]