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