From: Edward Smith-Rowland <3dw4rd@verizon.net> Date: Mon, 7 May 2018 16:23:29 +0000 (+0000) Subject: backport: re PR libstdc++/80506 (Wrong magic number in std::gamma_distribution) X-Git-Tag: releases/gcc-7.4.0~490 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12eb60f827c0443f32b2884ac068025c89f8c04c;p=thirdparty%2Fgcc.git backport: re PR libstdc++/80506 (Wrong magic number in std::gamma_distribution) 2018-05-07 Edward Smith-Rowland <3dw4rd@verizon.net> Jonathan Wakely Backport from mainline 2018-05-07 Edward Smith-Rowland <3dw4rd@verizon.net> PR libstdc++/80506 * include/bits/random.tcc (gamma_distribution::operator()): Fix magic number used in loop condition. (gamma_distribution::__generate_impl()): Ditto. Co-Authored-By: Jonathan Wakely From-SVN: r260006 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9456415a4b4a..aa35f4927770 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2018-05-07 Edward Smith-Rowland <3dw4rd@verizon.net> + Jonathan Wakely + + Backport from mainline + 2018-05-07 Edward Smith-Rowland <3dw4rd@verizon.net> + + PR libstdc++/80506 + * include/bits/random.tcc (gamma_distribution::operator()): Fix magic + number used in loop condition. + (gamma_distribution::__generate_impl()): Ditto. + 2018-05-03 Jonathan Wakely PR libstdc++/84769 diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index df05ebea6e9a..c43d85551c35 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))))); @@ -2405,7 +2405,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))))); @@ -2426,7 +2426,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)))));