diff options
author | Loren J. Rittle <ljrittle@acm.org> | 2002-01-18 22:07:27 +0000 |
---|---|---|
committer | Loren J. Rittle <ljrittle@gcc.gnu.org> | 2002-01-18 22:07:27 +0000 |
commit | 46827fdd40f93df1f94fa51adca6281d8a21f67d (patch) | |
tree | 12fdb5b096aa4ce1e3bf48a4bbeb5008ef9d851e /libstdc++-v3 | |
parent | d7af7a9ace3cda94c27b7b53d70fe4b697c76a67 (diff) | |
download | gcc-46827fdd40f93df1f94fa51adca6281d8a21f67d.tar.gz |
numeric_limits.cc (test_extrema<long double>): Add specialization for FreeBSD systems only to avoid losing test only due to...
* testsuite/18_support/numeric_limits.cc (test_extrema<long double>):
Add specialization for FreeBSD systems only to avoid losing test
only due to extra precision unmentioned in system headers.
From-SVN: r48997
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/18_support/numeric_limits.cc | 25 |
2 files changed, 31 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 603c5aff66d..d8ada879324 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2002-01-18 Loren Rittle <ljrittle@acm.org> + + * testsuite/18_support/numeric_limits.cc (test_extrema<long double>): + Add specialization for FreeBSD systems only to avoid losing test + only due to extra precision unmentioned in system headers. + 2002-01-18 David Billinghurst <David.Billinghurst@riotinto.com> * config/os/irix/irix6.5/bits/ctype_noninline.h: Fix typo diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits.cc b/libstdc++-v3/testsuite/18_support/numeric_limits.cc index 22c2a32d080..6cbeacb4d03 100644 --- a/libstdc++-v3/testsuite/18_support/numeric_limits.cc +++ b/libstdc++-v3/testsuite/18_support/numeric_limits.cc @@ -59,6 +59,31 @@ void test_extrema() VERIFY( extrema<T>::max == std::numeric_limits<T>::max() ); } +#ifdef __FreeBSD__ +// This specialization allows the extra precision unmentioned +// in system headers yet supported by long double on FreeBSD to +// not cause a gratuitous FAIL for the entire test. Using this +// technique to compare the residual against epsilon ensures that +// any major breakage will still be detected (although obviously not +// as tight as the exact equality check that would have been generated +// by default). This replacement test is allowable by the fact that +// C++ limits should match the system provided limits for C even if +// they were wrong verses the actual FP hardware. +template<> +void test_extrema<long double>() +{ + typedef long double T; + VERIFY( (extrema<T>::min - std::numeric_limits<T>::min()) + < std::numeric_limits<T>::epsilon() ); + VERIFY( (std::numeric_limits<T>::min() - extrema<T>::min) + < std::numeric_limits<T>::epsilon() ); + VERIFY( (extrema<T>::max / std::numeric_limits<T>::max()) + < (1 + std::numeric_limits<T>::epsilon()) ); + VERIFY( (std::numeric_limits<T>::max() / extrema<T>::max) + < (1 + std::numeric_limits<T>::epsilon()) ); +} +#endif + #ifdef __CHAR_UNSIGNED__ #define char_is_signed false #else |