fix doc example typo
[boost.git] / boost / limits.hpp
blob084b8739cfe7dbfab424edb58c4c4f9c148dce38
2 // (C) Copyright John maddock 1999.
3 // (C) David Abrahams 2002. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // use this header as a workaround for missing <limits>
9 // See http://www.boost.org/libs/compatibility/index.html for documentation.
11 #ifndef BOOST_LIMITS
12 #define BOOST_LIMITS
14 #include <boost/config.hpp>
16 #ifdef BOOST_NO_LIMITS
17 # include <boost/detail/limits.hpp>
18 #else
19 # include <limits>
20 #endif
22 #include <boost/detail/extended_integer.hpp> // for BOOST_HAS_XINT, etc.
24 #if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \
25 || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS))
26 // Add missing specializations for numeric_limits:
27 #if !defined(BOOST_HAS_XINT) || !(BOOST_HAS_XINT)
28 #error "Shouldn't have gotten here based on preceeding preprocessor statements"
29 #endif
30 #define BOOST_LLT ::boost::detail::xint_t
31 #define BOOST_ULLT ::boost::detail::uxint_t
33 #include <climits> // for CHAR_BIT
35 namespace std
37 template<>
38 class numeric_limits< BOOST_LLT >
40 public:
42 BOOST_STATIC_CONSTANT(bool, is_specialized = true);
43 static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return BOOST_XINT_MIN; }
44 static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return BOOST_XINT_MAX; }
45 BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1);
46 BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000);
47 BOOST_STATIC_CONSTANT(bool, is_signed = true);
48 BOOST_STATIC_CONSTANT(bool, is_integer = true);
49 BOOST_STATIC_CONSTANT(bool, is_exact = true);
50 BOOST_STATIC_CONSTANT(int, radix = 2);
51 static BOOST_LLT epsilon() throw() { return 0; };
52 static BOOST_LLT round_error() throw() { return 0; };
54 BOOST_STATIC_CONSTANT(int, min_exponent = 0);
55 BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
56 BOOST_STATIC_CONSTANT(int, max_exponent = 0);
57 BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
59 BOOST_STATIC_CONSTANT(bool, has_infinity = false);
60 BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
61 BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
62 BOOST_STATIC_CONSTANT(bool, has_denorm = false);
63 BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
64 static BOOST_LLT infinity() throw() { return 0; };
65 static BOOST_LLT quiet_NaN() throw() { return 0; };
66 static BOOST_LLT signaling_NaN() throw() { return 0; };
67 static BOOST_LLT denorm_min() throw() { return 0; };
69 BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
70 BOOST_STATIC_CONSTANT(bool, is_bounded = true);
71 BOOST_STATIC_CONSTANT(bool, is_modulo = true);
73 BOOST_STATIC_CONSTANT(bool, traps = false);
74 BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
75 BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
79 template<>
80 class numeric_limits< BOOST_ULLT >
82 public:
84 BOOST_STATIC_CONSTANT(bool, is_specialized = true);
85 static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return (BOOST_ULLT) 0u; }
86 static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return BOOST_UXINT_MAX; }
87 BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT);
88 BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT)) * 301L / 1000);
89 BOOST_STATIC_CONSTANT(bool, is_signed = false);
90 BOOST_STATIC_CONSTANT(bool, is_integer = true);
91 BOOST_STATIC_CONSTANT(bool, is_exact = true);
92 BOOST_STATIC_CONSTANT(int, radix = 2);
93 static BOOST_ULLT epsilon() throw() { return 0; };
94 static BOOST_ULLT round_error() throw() { return 0; };
96 BOOST_STATIC_CONSTANT(int, min_exponent = 0);
97 BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
98 BOOST_STATIC_CONSTANT(int, max_exponent = 0);
99 BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
101 BOOST_STATIC_CONSTANT(bool, has_infinity = false);
102 BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
103 BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
104 BOOST_STATIC_CONSTANT(bool, has_denorm = false);
105 BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
106 static BOOST_ULLT infinity() throw() { return 0; };
107 static BOOST_ULLT quiet_NaN() throw() { return 0; };
108 static BOOST_ULLT signaling_NaN() throw() { return 0; };
109 static BOOST_ULLT denorm_min() throw() { return 0; };
111 BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
112 BOOST_STATIC_CONSTANT(bool, is_bounded = true);
113 BOOST_STATIC_CONSTANT(bool, is_modulo = true);
115 BOOST_STATIC_CONSTANT(bool, traps = false);
116 BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
117 BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
121 #endif
123 #endif