2 // (C) Copyright Boost.org 1999. Permission to copy, use, modify, sell and
3 // distribute this software is granted provided this copyright notice appears
4 // in all copies. This software is provided "as is" without express or implied
5 // warranty, and with no claim as to its suitability for any purpose.
7 // use this header as a workaround for missing <limits>
12 #include <boost/config.hpp>
14 #ifdef BOOST_NO_LIMITS
15 # include <boost/detail/limits.hpp>
20 #if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \
21 || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS))
22 // Add missing specializations for numeric_limits:
23 #ifdef BOOST_HAS_MS_INT64
24 # define BOOST_LLT __int64
26 # define BOOST_LLT long long
32 class numeric_limits<BOOST_LLT>
36 BOOST_STATIC_CONSTANT(bool, is_specialized = true);
37 #ifdef BOOST_HAS_MS_INT64
38 static BOOST_LLT min(){ return 0x8000000000000000i64; }
39 static BOOST_LLT max(){ return 0x7FFFFFFFFFFFFFFFi64; }
40 #elif defined(LLONG_MAX)
41 static BOOST_LLT min(){ return LLONG_MIN; }
42 static BOOST_LLT max(){ return LLONG_MAX; }
43 #elif defined(LONGLONG_MAX)
44 static BOOST_LLT min(){ return LONGLONG_MIN; }
45 static BOOST_LLT max(){ return LONGLONG_MAX; }
47 static BOOST_LLT min(){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); }
48 static BOOST_LLT max(){ return ~min(); }
50 BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1);
51 BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000);
52 BOOST_STATIC_CONSTANT(bool, is_signed = true);
53 BOOST_STATIC_CONSTANT(bool, is_integer = true);
54 BOOST_STATIC_CONSTANT(bool, is_exact = true);
55 BOOST_STATIC_CONSTANT(int, radix = 2);
56 static BOOST_LLT epsilon() throw() { return 0; };
57 static BOOST_LLT round_error() throw() { return 0; };
59 BOOST_STATIC_CONSTANT(int, min_exponent = 0);
60 BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
61 BOOST_STATIC_CONSTANT(int, max_exponent = 0);
62 BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
64 BOOST_STATIC_CONSTANT(bool, has_infinity = false);
65 BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
66 BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
67 BOOST_STATIC_CONSTANT(bool, has_denorm = false);
68 BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
69 static BOOST_LLT infinity() throw() { return 0; };
70 static BOOST_LLT quiet_NaN() throw() { return 0; };
71 static BOOST_LLT signaling_NaN() throw() { return 0; };
72 static BOOST_LLT denorm_min() throw() { return 0; };
74 BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
75 BOOST_STATIC_CONSTANT(bool, is_bounded = false);
76 BOOST_STATIC_CONSTANT(bool, is_modulo = false);
78 BOOST_STATIC_CONSTANT(bool, traps = false);
79 BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
80 BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
85 class numeric_limits<unsigned BOOST_LLT>
89 BOOST_STATIC_CONSTANT(bool, is_specialized = true);
90 #ifdef BOOST_HAS_MS_INT64
91 static unsigned BOOST_LLT min(){ return 0ui64; }
92 static unsigned BOOST_LLT max(){ return 0xFFFFFFFFFFFFFFFFui64; }
93 #elif defined(ULLONG_MAX) && defined(ULLONG_MIN)
94 static unsigned BOOST_LLT min(){ return ULLONG_MIN; }
95 static unsigned BOOST_LLT max(){ return ULLONG_MAX; }
96 #elif defined(ULONGLONG_MAX) && defined(ULONG_LONG_MIN)
97 static unsigned BOOST_LLT min(){ return ULONGLONG_MIN; }
98 static unsigned BOOST_LLT max(){ return ULONGLONG_MAX; }
100 static unsigned BOOST_LLT min(){ return 0uLL; }
101 static unsigned BOOST_LLT max(){ return ~0uLL; }
103 BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1);
104 BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000);
105 BOOST_STATIC_CONSTANT(bool, is_signed = false);
106 BOOST_STATIC_CONSTANT(bool, is_integer = true);
107 BOOST_STATIC_CONSTANT(bool, is_exact = true);
108 BOOST_STATIC_CONSTANT(int, radix = 2);
109 static unsigned BOOST_LLT epsilon() throw() { return 0; };
110 static unsigned BOOST_LLT round_error() throw() { return 0; };
112 BOOST_STATIC_CONSTANT(int, min_exponent = 0);
113 BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
114 BOOST_STATIC_CONSTANT(int, max_exponent = 0);
115 BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
117 BOOST_STATIC_CONSTANT(bool, has_infinity = false);
118 BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
119 BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
120 BOOST_STATIC_CONSTANT(bool, has_denorm = false);
121 BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
122 static unsigned BOOST_LLT infinity() throw() { return 0; };
123 static unsigned BOOST_LLT quiet_NaN() throw() { return 0; };
124 static unsigned BOOST_LLT signaling_NaN() throw() { return 0; };
125 static unsigned BOOST_LLT denorm_min() throw() { return 0; };
127 BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
128 BOOST_STATIC_CONSTANT(bool, is_bounded = false);
129 BOOST_STATIC_CONSTANT(bool, is_modulo = false);
131 BOOST_STATIC_CONSTANT(bool, traps = false);
132 BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
133 BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);