File tree Expand file tree Collapse file tree 3 files changed +51
-1
lines changed
testsuite/26_numerics/random/chi_squared_distribution Expand file tree Collapse file tree 3 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 112018-01-15 Jonathan Wakely <
[email protected] >
22
3+ PR libstdc++/83833
4+ * include/bits/random.h (chi_squared_distribution::param): Update
5+ gamma distribution parameter.
6+ * testsuite/26_numerics/random/chi_squared_distribution/83833.cc: New
7+ test.
8+
39 PR libstdc++/83830
410 * include/std/type_traits (has_unique_object_representations_v): Add
511 variable template.
Original file line number Diff line number Diff line change @@ -2643,7 +2643,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
26432643 */
26442644 void
26452645 param (const param_type& __param)
2646- { _M_param = __param; }
2646+ {
2647+ _M_param = __param;
2648+ typedef typename std::gamma_distribution<result_type>::param_type
2649+ param_type;
2650+ _M_gd.param (param_type{__param.n () / 2 });
2651+ }
26472652
26482653 /* *
26492654 * @brief Returns the greatest lower bound value of the distribution.
Original file line number Diff line number Diff line change 1+ // Copyright (C) 2018 Free Software Foundation, Inc.
2+ //
3+ // This file is part of the GNU ISO C++ Library. This library is free
4+ // software; you can redistribute it and/or modify it under the
5+ // terms of the GNU General Public License as published by the
6+ // Free Software Foundation; either version 3, or (at your option)
7+ // any later version.
8+
9+ // This library is distributed in the hope that it will be useful,
10+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+ // GNU General Public License for more details.
13+
14+ // You should have received a copy of the GNU General Public License along
15+ // with this library; see the file COPYING3. If not see
16+ // <http://www.gnu.org/licenses/>.
17+
18+ // { dg-do run { target c++11 } }
19+
20+ #include < random>
21+ #include < testsuite_hooks.h>
22+
23+ void
24+ test01 ()
25+ {
26+ std::default_random_engine r1, r2;
27+ using chi = std::chi_squared_distribution<double >;
28+ chi::param_type p (5 );
29+ chi d1 (p);
30+ chi d2;
31+ d2.param (p);
32+ VERIFY ( d1 (r1) == d2 (r2) ); // PR libstdc++/83833
33+ }
34+
35+ int
36+ main ()
37+ {
38+ test01 ();
39+ }
You can’t perform that action at this time.
0 commit comments