2 // Copyright 2005-2009 Daniel James.
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 // On some platforms std::limits gives incorrect values for long double.
7 // This tries to work around them.
9 #if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER)
10 #define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER
12 #include <boost/config.hpp>
13 #if defined(BOOST_HAS_PRAGMA_ONCE)
17 #include <boost/limits.hpp>
19 // On OpenBSD, numeric_limits is not reliable for long doubles, but
20 // the macros defined in <float.h> are and support long double when STLport
23 #if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)
32 struct limits : std::numeric_limits<T> {};
34 #if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)
36 struct limits<long double>
37 : std::numeric_limits<long double>
39 static long double epsilon() {
43 static long double (max)() {
47 static long double (min)() {
51 BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG);
52 BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP);
53 BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP);
54 #if defined(_STLP_NO_LONG_DOUBLE)
55 BOOST_STATIC_CONSTANT(int, radix = FLT_RADIX);