diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-10 02:05:13 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-10 02:05:13 +0000 |
commit | c7b3f7cbc9559c183abea5feab67ea81fb9b9940 (patch) | |
tree | 6d3e047cb7440acf5457057991b12ca9d7a93b10 /libstdc++-v3/testsuite/18_support/numeric_limits/epsilon.cc | |
parent | 5385616230b8f6cb826fa540f47b07dc1c0c8717 (diff) | |
download | gcc-c7b3f7cbc9559c183abea5feab67ea81fb9b9940.tar.gz |
2005-11-09 Benjamin Kosnik <bkoz@redhat.com>
Paolo Carlini <pcarlini@suse.de>
Gabriel Dos Reis <gdr@integrable-solutions.net>
PR libstdc++/22203
* numeric_limits.cc: Split into...
* numeric_limits/specialization.cc: ..this.
* numeric_limits/is_iec559.cc: Same.
* numeric_limits/sign.cc: Same.
* numeric_limits/quiet_NaN.cc: Same.
* numeric_limits/digits10.cc: Same.
* numeric_limits/denorm_min.cc: Same.
* numeric_limits/min_max.cc: Same.
* numeric_limits/epsilon.cc: Same.
* numeric_limits/infinity.cc: Same.
* numeric_limits/traps.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106727 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/18_support/numeric_limits/epsilon.cc')
-rw-r--r-- | libstdc++-v3/testsuite/18_support/numeric_limits/epsilon.cc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/epsilon.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/epsilon.cc new file mode 100644 index 00000000000..9a0e755418c --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/numeric_limits/epsilon.cc @@ -0,0 +1,49 @@ +// { dg-options "-mieee" { target alpha*-*-* } } +// { dg-options "-mieee" { target sh*-*-* } } + +// 1999-08-23 bkoz + +// Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation +// +// 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. + +// 18.2.1.1 template class numeric_limits + +#include <limits> +#include <limits.h> +#include <float.h> +#include <cwchar> +#include <testsuite_hooks.h> + +template<typename T> +void test_epsilon() +{ + bool test __attribute__((unused)) = true; + T epsilon = std::numeric_limits<T>::epsilon(); + T one = 1; + + VERIFY( one != (one + epsilon) ); +} + +int main() +{ + test_epsilon<float>(); + test_epsilon<double>(); + test_epsilon<long double>(); + + return 0; +} |