From 46827fdd40f93df1f94fa51adca6281d8a21f67d Mon Sep 17 00:00:00 2001 From: "Loren J. Rittle" Date: Fri, 18 Jan 2002 22:07:27 +0000 Subject: [PATCH] numeric_limits.cc (test_extrema): Add specialization for FreeBSD systems only to avoid losing test only due to... * testsuite/18_support/numeric_limits.cc (test_extrema): Add specialization for FreeBSD systems only to avoid losing test only due to extra precision unmentioned in system headers. From-SVN: r48997 --- libstdc++-v3/ChangeLog | 6 +++++ .../testsuite/18_support/numeric_limits.cc | 25 +++++++++++++++++++ 2 files changed, 31 insertions(+) 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 + + * testsuite/18_support/numeric_limits.cc (test_extrema): + Add specialization for FreeBSD systems only to avoid losing test + only due to extra precision unmentioned in system headers. + 2002-01-18 David Billinghurst * 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::max == std::numeric_limits::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() +{ + typedef long double T; + VERIFY( (extrema::min - std::numeric_limits::min()) + < std::numeric_limits::epsilon() ); + VERIFY( (std::numeric_limits::min() - extrema::min) + < std::numeric_limits::epsilon() ); + VERIFY( (extrema::max / std::numeric_limits::max()) + < (1 + std::numeric_limits::epsilon()) ); + VERIFY( (std::numeric_limits::max() / extrema::max) + < (1 + std::numeric_limits::epsilon()) ); +} +#endif + #ifdef __CHAR_UNSIGNED__ #define char_is_signed false #else -- 2.30.2