mirror of git://gcc.gnu.org/git/gcc.git
re PR libstdc++/56202 (SIGFPE (division by zero) in std::binomial_distribution)
2013-02-04 Manuel López-Ibáñez <manu@gcc.gnu.org> Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/56202 * include/bits/random.tcc (binomial_distribution<>:: _M_waiting(_UniformRandomNumberGenerator&, _IntType)): Avoid division by zero. Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com> From-SVN: r195722
This commit is contained in:
parent
152689dc44
commit
85018f40ae
|
|
@ -1,3 +1,11 @@
|
||||||
|
2013-02-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
|
||||||
|
Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
PR libstdc++/56202
|
||||||
|
* include/bits/random.tcc (binomial_distribution<>::
|
||||||
|
_M_waiting(_UniformRandomNumberGenerator&, _IntType)): Avoid
|
||||||
|
division by zero.
|
||||||
|
|
||||||
2013-02-03 Richard Sandiford <rdsandiford@googlemail.com>
|
2013-02-03 Richard Sandiford <rdsandiford@googlemail.com>
|
||||||
|
|
||||||
Update copyright years.
|
Update copyright years.
|
||||||
|
|
|
||||||
|
|
@ -1658,6 +1658,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
const double __e = -std::log(1.0 - __aurng());
|
const double __e = -std::log(1.0 - __aurng());
|
||||||
|
if (__t == __x)
|
||||||
|
{
|
||||||
|
if (__e)
|
||||||
|
return __x;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
__sum += __e / (__t - __x);
|
__sum += __e / (__t - __x);
|
||||||
__x += 1;
|
__x += 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue