From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10621 invoked by alias); 22 Jun 2013 13:35:53 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 10594 invoked by uid 48); 22 Jun 2013 13:35:44 -0000 From: "schlaffi at users dot sourceforge.net" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/57674] New: wrong distribution for std::binomial_distribution::operator()(g,param) Date: Sat, 22 Jun 2013 13:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.7.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: schlaffi at users dot sourceforge.net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg01204.txt.bz2 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.