OSDN Git Service

* testsuite/18_support/numeric_limits.cc (test_epsilon): New.
authorljrittle <ljrittle@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Sep 2002 04:26:25 +0000 (04:26 +0000)
committerljrittle <ljrittle@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Sep 2002 04:26:25 +0000 (04:26 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57295 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 62835f5..8ee3825 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 2213b7f..65fc8d0 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>();