diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-08-22 18:07:55 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-08-22 18:07:55 +0000 |
commit | 5e1bc357004e11ea98156d532fa106960f2eb5b5 (patch) | |
tree | 679adf62a0a441d998be29fc26947adef42bb8b4 /libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3_01.cc | |
parent | 78350879556239f5d05ec2e1f7f08a53704ea2cf (diff) | |
download | gcc-5e1bc357004e11ea98156d532fa106960f2eb5b5.tar.gz |
2006-08-22 Paolo Carlini <pcarlini@suse.de>
* include/tr1/random (class subtract_with_carry_01): Add.
* include/tr1/random.tcc (subtract_with_carry_01<>::
seed(unsigned long), subtract_with_carry_01<>::
seed(_Gen&, false_type), subtract_with_carry_01<>::
operator(), operator<<(std::basic_ostream<>&, const
subtract_with_carry_01<>&), operator>>(std::basic_istream<>&,
subtract_with_carry_01<>&)): Define.
* testsuite/tr1/5_numerical_facilities/random/ranlux3_01.cc:
New.
* testsuite/tr1/5_numerical_facilities/random/ranlux4_01.cc:
Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry_01/cons/seed1.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry_01/cons/seed2.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry_01/cons/default.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry_01/cons/gen1.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry_01/requirements/typedefs.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry_01/operators/equal.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry_01/operators/not_equal.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry_01/operators/serialize.cc: Likewise.
* docs/html/ext/howto.html: Add two implemented TR1 issues.
* include/tr1/random.tcc (struct _To_Unsigned_Type): Move...
* include/tr1/random: ... here.
(class subtract_with_carry): Use it everywhere.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry/cons/seed1.cc: Qualify 1 as 1UL.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry/cons/seed2.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry/cons/default.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry/cons/gen1.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry/requirements/typedefs.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry/operators/equal.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry/operators/not_equal.cc: Likewise.
* testsuite/tr1/5_numerical_facilities/random/
subtract_with_carry/operators/serialize.cc: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116327 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3_01.cc')
-rw-r--r-- | libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3_01.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3_01.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3_01.cc new file mode 100644 index 00000000000..fc9cb3dd7a6 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/ranlux3_01.cc @@ -0,0 +1,48 @@ +// 2006-08-22 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2006 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 5.1.5 Engines with predefined parameters +// 5.1.5 [3] + +#include <iostream> +#include <tr1/random> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::tr1::ranlux3_01 a; + for (int i = 0; i < 9999; ++i) + a(); + +#if _GLIBCXX_USE_C99_MATH_TR1 + VERIFY( a() == 5957620 * std::tr1::ldexp(float(1), -24) ); +#else + VERIFY( a() == 5957620 * std::pow(float(2), -24) ); +#endif +} + +int main() +{ + test01(); + return 0; +} |