This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/56202] SIGFPE (division by zero) in std::binomial_distribution
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 04 Feb 2013 15:46:39 +0000
- Subject: [Bug libstdc++/56202] SIGFPE (division by zero) in std::binomial_distribution
- Auto-submitted: auto-generated
- References: <bug-56202-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56202
Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #2 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> 2013-02-04 15:46:39 UTC ---
Hum, this seems to be the second waiting method described in page 41 of
http://luc.devroye.org/chapter_ten.pdf
which specifically says that sum can be infinite. So I think it should be
enough to check that __t == __x and return __x in that case.
do
{
const double __e = -std::log(1.0 - __aurng());
if(__t == __x) return __x;
__sum += __e / (__t - __x);
__x += 1;
}
while (__sum <= _M_param._M_q);
No?