* testsuite/18_support/numeric_limits.cc (test_epsilon): New.
authorLoren J. Rittle <ljrittle@acm.org>
Thu, 19 Sep 2002 04:26:25 +0000 (04:26 +0000)
committerLoren J. Rittle <ljrittle@gcc.gnu.org>
Thu, 19 Sep 2002 04:26:25 +0000 (04:26 +0000)
From-SVN: r57295

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/18_support/numeric_limits.cc

index 62835f5afde4394347708f7ab6d36a7c7dc6f1e9..8ee38258a4ce6b87b6389af22408313d2064edb8 100644 (file)
@@ -1,3 +1,7 @@
+2002-09-18  Loren J. Rittle  <ljrittle@acm.org>
+
+       * testsuite/18_support/numeric_limits.cc (test_epsilon): New.
+
 2002-09-18  Richard Henderson  <rth@redhat.com>
 
        * testsuite/18_support/numeric_limits.cc: Add -mieee for alpha.
index 2213b7f2f67cbd8cdd30aa952b8e8fae3af559dc..65fc8d03c57b4965f87ab0470084edb476038697 100644 (file)
@@ -94,6 +94,16 @@ void test_extrema<long double>()
 }
 #endif
 
+template<typename T>
+void test_epsilon()
+{
+  bool test = true;
+  T epsilon = std::numeric_limits<T>::epsilon();
+  T one = 1;
+
+  VERIFY( one != (one + epsilon) );
+}
+
 #ifdef __CHAR_UNSIGNED__
 #define char_is_signed false
 #else
@@ -314,6 +324,10 @@ int main()
   test_extrema<double>();
   test_extrema<long double>();
 
+  test_epsilon<float>();
+  test_epsilon<double>();
+  test_epsilon<long double>();
+
   test_sign();
 
   test_infinity<float>();