We use the wrong constant for the Marsaglia Tsang algorithm.
PR libstdc++/80506 * include/bits/random.tcc (gamma_distribution::operator()): Fix magic number used in loop condition. Tested powerpc64le-linux, committed to trunk.
commit aa4da6523b7bfab7ba92c2e9e505155e1ce432a7 Author: Jonathan Wakely <jwak...@redhat.com> Date: Mon Apr 24 13:10:49 2017 +0100 PR libstdc++/80506 fix constant used in condition PR libstdc++/80506 * include/bits/random.tcc (gamma_distribution::operator()): Fix magic number used in loop condition. diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index df05ebe..63d1c02 100644 --- a/libstdc++-v3/include/bits/random.tcc +++ b/libstdc++-v3/include/bits/random.tcc @@ -2356,7 +2356,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __v = __v * __v * __v; __u = __aurng(); } - while (__u > result_type(1.0) - 0.331 * __n * __n * __n * __n + while (__u > result_type(1.0) - 0.0331 * __n * __n * __n * __n && (std::log(__u) > (0.5 * __n * __n + __a1 * (1.0 - __v + std::log(__v)))));