mirror of git://gcc.gnu.org/git/gcc.git
* testsuite/18_support/numeric_limits.cc (test_epsilon): New.
From-SVN: r57295
This commit is contained in:
parent
bf3d27e689
commit
b433da3cac
|
|
@ -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>
|
2002-09-18 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
* testsuite/18_support/numeric_limits.cc: Add -mieee for alpha.
|
* testsuite/18_support/numeric_limits.cc: Add -mieee for alpha.
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,16 @@ void test_extrema<long double>()
|
||||||
}
|
}
|
||||||
#endif
|
#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__
|
#ifdef __CHAR_UNSIGNED__
|
||||||
#define char_is_signed false
|
#define char_is_signed false
|
||||||
#else
|
#else
|
||||||
|
|
@ -314,6 +324,10 @@ int main()
|
||||||
test_extrema<double>();
|
test_extrema<double>();
|
||||||
test_extrema<long double>();
|
test_extrema<long double>();
|
||||||
|
|
||||||
|
test_epsilon<float>();
|
||||||
|
test_epsilon<double>();
|
||||||
|
test_epsilon<long double>();
|
||||||
|
|
||||||
test_sign();
|
test_sign();
|
||||||
|
|
||||||
test_infinity<float>();
|
test_infinity<float>();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue