limits.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef BOOST_LIMITS
00012 #define BOOST_LIMITS
00013
00014 #include <boost/config.hpp>
00015
00016 #ifdef BOOST_NO_LIMITS
00017 # include <boost/detail/limits.hpp>
00018 #else
00019 # include <limits>
00020 #endif
00021
00022 #if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \
00023 || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS))
00024
00025 #ifdef BOOST_HAS_MS_INT64
00026 # define BOOST_LLT __int64
00027 # define BOOST_ULLT unsigned __int64
00028 #else
00029 # define BOOST_LLT ::boost::long_long_type
00030 # define BOOST_ULLT ::boost::ulong_long_type
00031 #endif
00032
00033 namespace std
00034 {
00035 template<>
00036 class numeric_limits<BOOST_LLT>
00037 {
00038 public:
00039
00040 BOOST_STATIC_CONSTANT(bool, is_specialized = true);
00041 #ifdef BOOST_HAS_MS_INT64
00042 static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x8000000000000000i64; }
00043 static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x7FFFFFFFFFFFFFFFi64; }
00044 #elif defined(LLONG_MAX)
00045 static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MIN; }
00046 static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MAX; }
00047 #elif defined(LONGLONG_MAX)
00048 static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MIN; }
00049 static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MAX; }
00050 #else
00051 static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); }
00052 static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~(min)(); }
00053 #endif
00054 BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1);
00055 BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000);
00056 BOOST_STATIC_CONSTANT(bool, is_signed = true);
00057 BOOST_STATIC_CONSTANT(bool, is_integer = true);
00058 BOOST_STATIC_CONSTANT(bool, is_exact = true);
00059 BOOST_STATIC_CONSTANT(int, radix = 2);
00060 static BOOST_LLT epsilon() throw() { return 0; };
00061 static BOOST_LLT round_error() throw() { return 0; };
00062
00063 BOOST_STATIC_CONSTANT(int, min_exponent = 0);
00064 BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
00065 BOOST_STATIC_CONSTANT(int, max_exponent = 0);
00066 BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
00067
00068 BOOST_STATIC_CONSTANT(bool, has_infinity = false);
00069 BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
00070 BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
00071 BOOST_STATIC_CONSTANT(bool, has_denorm = false);
00072 BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
00073 static BOOST_LLT infinity() throw() { return 0; };
00074 static BOOST_LLT quiet_NaN() throw() { return 0; };
00075 static BOOST_LLT signaling_NaN() throw() { return 0; };
00076 static BOOST_LLT denorm_min() throw() { return 0; };
00077
00078 BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
00079 BOOST_STATIC_CONSTANT(bool, is_bounded = true);
00080 BOOST_STATIC_CONSTANT(bool, is_modulo = true);
00081
00082 BOOST_STATIC_CONSTANT(bool, traps = false);
00083 BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
00084 BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
00085
00086 };
00087
00088 template<>
00089 class numeric_limits<BOOST_ULLT>
00090 {
00091 public:
00092
00093 BOOST_STATIC_CONSTANT(bool, is_specialized = true);
00094 #ifdef BOOST_HAS_MS_INT64
00095 static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0ui64; }
00096 static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0xFFFFFFFFFFFFFFFFui64; }
00097 #elif defined(ULLONG_MAX) && defined(ULLONG_MIN)
00098 static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MIN; }
00099 static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MAX; }
00100 #elif defined(ULONGLONG_MAX) && defined(ULONGLONG_MIN)
00101 static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MIN; }
00102 static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MAX; }
00103 #else
00104 static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0uLL; }
00105 static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~0uLL; }
00106 #endif
00107 BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT);
00108 BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT)) * 301L / 1000);
00109 BOOST_STATIC_CONSTANT(bool, is_signed = false);
00110 BOOST_STATIC_CONSTANT(bool, is_integer = true);
00111 BOOST_STATIC_CONSTANT(bool, is_exact = true);
00112 BOOST_STATIC_CONSTANT(int, radix = 2);
00113 static BOOST_ULLT epsilon() throw() { return 0; };
00114 static BOOST_ULLT round_error() throw() { return 0; };
00115
00116 BOOST_STATIC_CONSTANT(int, min_exponent = 0);
00117 BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
00118 BOOST_STATIC_CONSTANT(int, max_exponent = 0);
00119 BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
00120
00121 BOOST_STATIC_CONSTANT(bool, has_infinity = false);
00122 BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
00123 BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
00124 BOOST_STATIC_CONSTANT(bool, has_denorm = false);
00125 BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
00126 static BOOST_ULLT infinity() throw() { return 0; };
00127 static BOOST_ULLT quiet_NaN() throw() { return 0; };
00128 static BOOST_ULLT signaling_NaN() throw() { return 0; };
00129 static BOOST_ULLT denorm_min() throw() { return 0; };
00130
00131 BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
00132 BOOST_STATIC_CONSTANT(bool, is_bounded = true);
00133 BOOST_STATIC_CONSTANT(bool, is_modulo = true);
00134
00135 BOOST_STATIC_CONSTANT(bool, traps = false);
00136 BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
00137 BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
00138
00139 };
00140 }
00141 #endif
00142
00143 #endif
00144