From ce6a32dd5847cad20cbd0fe7796cc928e60619a9 Mon Sep 17 00:00:00 2001 From: Andrey Zholos Date: Mon, 14 Mar 2011 18:10:36 +0000 Subject: [PATCH] re PR libstdc++/48114 ([C++0x] binomial_distribution incorrect for p > .5 and geometric_distribution wrongly implements the TR1 definition) 2011-03-14 Andrey Zholos PR libstdc++/48114 * include/bits/random.tcc (binomial_distribution<>::operator()): Fix thinko in computation, __param.p() is a double. From-SVN: r170950 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/include/bits/random.tcc | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6664a00b88ad..e658556debaa 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2011-03-14 Andrey Zholos + + PR libstdc++/48114 + * include/bits/random.tcc (binomial_distribution<>::operator()): + Fix thinko in computation, __param.p() is a double. + 2011-02-25 Johannes Singler PR libstdc++/47433 diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index 7efd6f8e4014..d3e2ac76c2d9 100644 --- a/libstdc++-v3/include/bits/random.tcc +++ b/libstdc++-v3/include/bits/random.tcc @@ -1,6 +1,6 @@ // random number generation (out of line) -*- C++ -*- -// Copyright (C) 2009, 2010 Free Software Foundation, Inc. +// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -1392,7 +1392,7 @@ namespace std { result_type __ret; const _IntType __t = __param.t(); - const _IntType __p = __param.p(); + const double __p = __param.p(); const double __p12 = __p <= 0.5 ? __p : 1.0 - __p; __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); -- 2.47.2