]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/std_real_concept_check.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / math / test / std_real_concept_check.cpp
1 // Copyright John Maddock 2006.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #define BOOST_MATH_ASSERT_UNDEFINED_POLICY false
7
8 #include <boost/math/concepts/std_real_concept.hpp>
9 #include <boost/math/concepts/distributions.hpp>
10
11 #include "compile_test/instantiate.hpp"
12
13 //
14 // The purpose of this test is to verify that our code compiles
15 // cleanly with a type whose std lib functions are in namespace
16 // std and can *not* be found by ADL. This verifies that we're
17 // not finding std lib functions that are in the global namespace
18 // for example calling ::pow(double) rather than std::pow(long double).
19 // This is a silent error that does the wrong thing at runtime, and
20 // of course we can't call std::pow() directly because we want
21 // the functions to be found by ADL when that's appropriate.
22 //
23 // Furthermore our code does different things internally depending
24 // on numeric_limits<>::digits, so there are some macros that can
25 // be defined that cause our concept-archetype to emulate various
26 // floating point types:
27 //
28 // EMULATE32: 32-bit float
29 // EMULATE64: 64-bit double
30 // EMULATE80: 80-bit long double
31 // EMULATE128: 128-bit long double
32 //
33 // In order to ensure total code coverage this file must be
34 // compiled with each of the above macros in turn, and then
35 // without any of the above as well!
36 //
37
38 #define NULL_MACRO /**/
39 #ifdef EMULATE32
40 namespace std{
41 template<>
42 struct numeric_limits<boost::math::concepts::std_real_concept>
43 {
44 static const bool is_specialized = true;
45 static boost::math::concepts::std_real_concept min NULL_MACRO() throw();
46 static boost::math::concepts::std_real_concept max NULL_MACRO() throw();
47 static const int digits = 24;
48 static const int digits10 = 6;
49 static const bool is_signed = true;
50 static const bool is_integer = false;
51 static const bool is_exact = false;
52 static const int radix = 2;
53 static boost::math::concepts::std_real_concept epsilon() throw();
54 static boost::math::concepts::std_real_concept round_error() throw();
55 static const int min_exponent = -125;
56 static const int min_exponent10 = -37;
57 static const int max_exponent = 128;
58 static const int max_exponent10 = 38;
59 static const bool has_infinity = true;
60 static const bool has_quiet_NaN = true;
61 static const bool has_signaling_NaN = true;
62 static const float_denorm_style has_denorm = denorm_absent;
63 static const bool has_denorm_loss = false;
64 static boost::math::concepts::std_real_concept infinity() throw();
65 static boost::math::concepts::std_real_concept quiet_NaN() throw();
66 static boost::math::concepts::std_real_concept signaling_NaN() throw();
67 static boost::math::concepts::std_real_concept denorm_min() throw();
68 static const bool is_iec559 = true;
69 static const bool is_bounded = false;
70 static const bool is_modulo = false;
71 static const bool traps = false;
72 static const bool tinyness_before = false;
73 static const float_round_style round_style = round_toward_zero;
74 };
75 }
76 #endif
77 #ifdef EMULATE64
78 namespace std{
79 template<>
80 struct numeric_limits<boost::math::concepts::std_real_concept>
81 {
82 static const bool is_specialized = true;
83 static boost::math::concepts::std_real_concept min NULL_MACRO() throw();
84 static boost::math::concepts::std_real_concept max NULL_MACRO() throw();
85 static const int digits = 53;
86 static const int digits10 = 15;
87 static const bool is_signed = true;
88 static const bool is_integer = false;
89 static const bool is_exact = false;
90 static const int radix = 2;
91 static boost::math::concepts::std_real_concept epsilon() throw();
92 static boost::math::concepts::std_real_concept round_error() throw();
93 static const int min_exponent = -1021;
94 static const int min_exponent10 = -307;
95 static const int max_exponent = 1024;
96 static const int max_exponent10 = 308;
97 static const bool has_infinity = true;
98 static const bool has_quiet_NaN = true;
99 static const bool has_signaling_NaN = true;
100 static const float_denorm_style has_denorm = denorm_absent;
101 static const bool has_denorm_loss = false;
102 static boost::math::concepts::std_real_concept infinity() throw();
103 static boost::math::concepts::std_real_concept quiet_NaN() throw();
104 static boost::math::concepts::std_real_concept signaling_NaN() throw();
105 static boost::math::concepts::std_real_concept denorm_min() throw();
106 static const bool is_iec559 = true;
107 static const bool is_bounded = false;
108 static const bool is_modulo = false;
109 static const bool traps = false;
110 static const bool tinyness_before = false;
111 static const float_round_style round_style = round_toward_zero;
112 };
113 }
114 #endif
115 #ifdef EMULATE80
116 namespace std{
117 template<>
118 struct numeric_limits<boost::math::concepts::std_real_concept>
119 {
120 static const bool is_specialized = true;
121 static boost::math::concepts::std_real_concept min NULL_MACRO() throw();
122 static boost::math::concepts::std_real_concept max NULL_MACRO() throw();
123 static const int digits = 64;
124 static const int digits10 = 18;
125 static const bool is_signed = true;
126 static const bool is_integer = false;
127 static const bool is_exact = false;
128 static const int radix = 2;
129 static boost::math::concepts::std_real_concept epsilon() throw();
130 static boost::math::concepts::std_real_concept round_error() throw();
131 static const int min_exponent = -16381;
132 static const int min_exponent10 = -4931;
133 static const int max_exponent = 16384;
134 static const int max_exponent10 = 4932;
135 static const bool has_infinity = true;
136 static const bool has_quiet_NaN = true;
137 static const bool has_signaling_NaN = true;
138 static const float_denorm_style has_denorm = denorm_absent;
139 static const bool has_denorm_loss = false;
140 static boost::math::concepts::std_real_concept infinity() throw();
141 static boost::math::concepts::std_real_concept quiet_NaN() throw();
142 static boost::math::concepts::std_real_concept signaling_NaN() throw();
143 static boost::math::concepts::std_real_concept denorm_min() throw();
144 static const bool is_iec559 = true;
145 static const bool is_bounded = false;
146 static const bool is_modulo = false;
147 static const bool traps = false;
148 static const bool tinyness_before = false;
149 static const float_round_style round_style = round_toward_zero;
150 };
151 }
152 #endif
153 #ifdef EMULATE128
154 namespace std{
155 template<>
156 struct numeric_limits<boost::math::concepts::std_real_concept>
157 {
158 static const bool is_specialized = true;
159 static boost::math::concepts::std_real_concept min NULL_MACRO() throw();
160 static boost::math::concepts::std_real_concept max NULL_MACRO() throw();
161 static const int digits = 113;
162 static const int digits10 = 33;
163 static const bool is_signed = true;
164 static const bool is_integer = false;
165 static const bool is_exact = false;
166 static const int radix = 2;
167 static boost::math::concepts::std_real_concept epsilon() throw();
168 static boost::math::concepts::std_real_concept round_error() throw();
169 static const int min_exponent = -16381;
170 static const int min_exponent10 = -4931;
171 static const int max_exponent = 16384;
172 static const int max_exponent10 = 4932;
173 static const bool has_infinity = true;
174 static const bool has_quiet_NaN = true;
175 static const bool has_signaling_NaN = true;
176 static const float_denorm_style has_denorm = denorm_absent;
177 static const bool has_denorm_loss = false;
178 static boost::math::concepts::std_real_concept infinity() throw();
179 static boost::math::concepts::std_real_concept quiet_NaN() throw();
180 static boost::math::concepts::std_real_concept signaling_NaN() throw();
181 static boost::math::concepts::std_real_concept denorm_min() throw();
182 static const bool is_iec559 = true;
183 static const bool is_bounded = false;
184 static const bool is_modulo = false;
185 static const bool traps = false;
186 static const bool tinyness_before = false;
187 static const float_round_style round_style = round_toward_zero;
188 };
189 }
190 #endif
191
192
193
194 int main()
195 {
196 instantiate(boost::math::concepts::std_real_concept(0));
197 }
198
199