Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/limits.hpp @ 66

Last change on this file since 66 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 5.9 KB
Line 
1
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>
8
9//  See http://www.boost.org/libs/utility/limits.html for documentation.
10
11#ifndef BOOST_LIMITS
12#define BOOST_LIMITS
13
14#include <boost/config.hpp>
15
16#ifdef BOOST_NO_LIMITS
17# include <boost/detail/limits.hpp>
18#else
19# include <limits>
20#endif
21
22#if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \
23      || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS))
24// Add missing specializations for numeric_limits:
25#ifdef BOOST_HAS_MS_INT64
26#  define BOOST_LLT __int64
27#  define BOOST_ULLT unsigned __int64
28#else
29#  define BOOST_LLT  ::boost::long_long_type
30#  define BOOST_ULLT  ::boost::ulong_long_type
31#endif
32
33namespace std
34{
35  template<>
36  class numeric_limits<BOOST_LLT> 
37  {
38   public:
39
40      BOOST_STATIC_CONSTANT(bool, is_specialized = true);
41#ifdef BOOST_HAS_MS_INT64
42      static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x8000000000000000i64; }
43      static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x7FFFFFFFFFFFFFFFi64; }
44#elif defined(LLONG_MAX)
45      static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MIN; }
46      static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MAX; }
47#elif defined(LONGLONG_MAX)
48      static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MIN; }
49      static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MAX; }
50#else
51      static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); }
52      static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~(min)(); }
53#endif
54      BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1);
55      BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000);
56      BOOST_STATIC_CONSTANT(bool, is_signed = true);
57      BOOST_STATIC_CONSTANT(bool, is_integer = true);
58      BOOST_STATIC_CONSTANT(bool, is_exact = true);
59      BOOST_STATIC_CONSTANT(int, radix = 2);
60      static BOOST_LLT epsilon() throw() { return 0; };
61      static BOOST_LLT round_error() throw() { return 0; };
62
63      BOOST_STATIC_CONSTANT(int, min_exponent = 0);
64      BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
65      BOOST_STATIC_CONSTANT(int, max_exponent = 0);
66      BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
67
68      BOOST_STATIC_CONSTANT(bool, has_infinity = false);
69      BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
70      BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
71      BOOST_STATIC_CONSTANT(bool, has_denorm = false);
72      BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
73      static BOOST_LLT infinity() throw() { return 0; };
74      static BOOST_LLT quiet_NaN() throw() { return 0; };
75      static BOOST_LLT signaling_NaN() throw() { return 0; };
76      static BOOST_LLT denorm_min() throw() { return 0; };
77
78      BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
79      BOOST_STATIC_CONSTANT(bool, is_bounded = true);
80      BOOST_STATIC_CONSTANT(bool, is_modulo = true);
81
82      BOOST_STATIC_CONSTANT(bool, traps = false);
83      BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
84      BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
85     
86  };
87
88  template<>
89  class numeric_limits<BOOST_ULLT> 
90  {
91   public:
92
93      BOOST_STATIC_CONSTANT(bool, is_specialized = true);
94#ifdef BOOST_HAS_MS_INT64
95      static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0ui64; }
96      static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0xFFFFFFFFFFFFFFFFui64; }
97#elif defined(ULLONG_MAX) && defined(ULLONG_MIN)
98      static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MIN; }
99      static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MAX; }
100#elif defined(ULONGLONG_MAX) && defined(ULONGLONG_MIN)
101      static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MIN; }
102      static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MAX; }
103#else
104      static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0uLL; }
105      static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~0uLL; }
106#endif
107      BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT);
108      BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT)) * 301L / 1000);
109      BOOST_STATIC_CONSTANT(bool, is_signed = false);
110      BOOST_STATIC_CONSTANT(bool, is_integer = true);
111      BOOST_STATIC_CONSTANT(bool, is_exact = true);
112      BOOST_STATIC_CONSTANT(int, radix = 2);
113      static BOOST_ULLT epsilon() throw() { return 0; };
114      static BOOST_ULLT round_error() throw() { return 0; };
115
116      BOOST_STATIC_CONSTANT(int, min_exponent = 0);
117      BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
118      BOOST_STATIC_CONSTANT(int, max_exponent = 0);
119      BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
120
121      BOOST_STATIC_CONSTANT(bool, has_infinity = false);
122      BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
123      BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
124      BOOST_STATIC_CONSTANT(bool, has_denorm = false);
125      BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
126      static BOOST_ULLT infinity() throw() { return 0; };
127      static BOOST_ULLT quiet_NaN() throw() { return 0; };
128      static BOOST_ULLT signaling_NaN() throw() { return 0; };
129      static BOOST_ULLT denorm_min() throw() { return 0; };
130
131      BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
132      BOOST_STATIC_CONSTANT(bool, is_bounded = true);
133      BOOST_STATIC_CONSTANT(bool, is_modulo = true);
134
135      BOOST_STATIC_CONSTANT(bool, traps = false);
136      BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
137      BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
138     
139  };
140}
141#endif
142
143#endif
144
Note: See TracBrowser for help on using the repository browser.