public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/57674] New: wrong distribution for  std::binomial_distribution::operator()(g,param)
@ 2013-06-22 13:35 schlaffi at users dot sourceforge.net
  2013-06-22 13:46 ` [Bug libstdc++/57674] " schlaffi at users dot sourceforge.net
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: schlaffi at users dot sourceforge.net @ 2013-06-22 13:35 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/57674] wrong distribution for  std::binomial_distribution::operator()(g,param)
  2013-06-22 13:35 [Bug libstdc++/57674] New: wrong distribution for std::binomial_distribution::operator()(g,param) schlaffi at users dot sourceforge.net
@ 2013-06-22 13:46 ` schlaffi at users dot sourceforge.net
  2013-06-22 17:58 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: schlaffi at users dot sourceforge.net @ 2013-06-22 13:46 UTC (permalink / raw)
  To: gcc-bugs

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

schlaffi at users dot sourceforge.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.7.2                       |lno

--- Comment #1 from schlaffi at users dot sourceforge.net ---
i mean v4.7.2 :o


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/57674] wrong distribution for  std::binomial_distribution::operator()(g,param)
  2013-06-22 13:35 [Bug libstdc++/57674] New: wrong distribution for std::binomial_distribution::operator()(g,param) schlaffi at users dot sourceforge.net
  2013-06-22 13:46 ` [Bug libstdc++/57674] " schlaffi at users dot sourceforge.net
@ 2013-06-22 17:58 ` paolo.carlini at oracle dot com
  2013-06-22 21:08 ` paolo.carlini at oracle dot com
  2013-06-22 23:18 ` schlaffi at users dot sourceforge.net
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-22 17:58 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-06-22
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.8.2
     Ever confirmed|0                           |1

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Thanks. It's indeed a stupid bug, but I would call it thinko more than typo (in
jargon): what is happening is that the operator (_M_waiting in particular) is
using the _M_q of the distribution itself (stored in _M_param._M_q), instead of
that coming with param, aka param._M_q. I'll fix it asap.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/57674] wrong distribution for  std::binomial_distribution::operator()(g,param)
  2013-06-22 13:35 [Bug libstdc++/57674] New: wrong distribution for std::binomial_distribution::operator()(g,param) schlaffi at users dot sourceforge.net
  2013-06-22 13:46 ` [Bug libstdc++/57674] " schlaffi at users dot sourceforge.net
  2013-06-22 17:58 ` paolo.carlini at oracle dot com
@ 2013-06-22 21:08 ` paolo.carlini at oracle dot com
  2013-06-22 23:18 ` schlaffi at users dot sourceforge.net
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-22 21:08 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed mainline and 4.8.2.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/57674] wrong distribution for  std::binomial_distribution::operator()(g,param)
  2013-06-22 13:35 [Bug libstdc++/57674] New: wrong distribution for std::binomial_distribution::operator()(g,param) schlaffi at users dot sourceforge.net
                   ` (2 preceding siblings ...)
  2013-06-22 21:08 ` paolo.carlini at oracle dot com
@ 2013-06-22 23:18 ` schlaffi at users dot sourceforge.net
  3 siblings, 0 replies; 5+ messages in thread
From: schlaffi at users dot sourceforge.net @ 2013-06-22 23:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from schlaffi at users dot sourceforge.net ---
yes, it's fixed :) I tested various examples (also large param.t).


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-06-22 23:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-22 13:35 [Bug libstdc++/57674] New: wrong distribution for std::binomial_distribution::operator()(g,param) schlaffi at users dot sourceforge.net
2013-06-22 13:46 ` [Bug libstdc++/57674] " schlaffi at users dot sourceforge.net
2013-06-22 17:58 ` paolo.carlini at oracle dot com
2013-06-22 21:08 ` paolo.carlini at oracle dot com
2013-06-22 23:18 ` schlaffi at users dot sourceforge.net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).