Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / math / cstdfloat / cstdfloat_types.hpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright Christopher Kormanyos 2014.
3 // Copyright John Maddock 2014.
4 // Copyright Paul Bristow 2014.
5 // Distributed under the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt
7 // or copy at http://www.boost.org/LICENSE_1_0.txt)
8 //
9
10 // Implement the types for floating-point typedefs having specified widths.
11
12 #ifndef _BOOST_CSTDFLOAT_TYPES_2014_01_09_HPP_
13   #define _BOOST_CSTDFLOAT_TYPES_2014_01_09_HPP_
14
15   #include <float.h>
16   #include <limits>
17   #include <boost/static_assert.hpp>
18   #include <boost/math/tools/config.hpp>
19
20   // This is the beginning of the preamble.
21
22   // In this preamble, the preprocessor is used to query certain
23   // preprocessor definitions from <float.h>. Based on the results
24   // of these queries, an attempt is made to automatically detect
25   // the presence of built-in floating-point types having specified
26   // widths. These are *thought* to be conformant with IEEE-754,
27   // whereby an unequivocal test based on std::numeric_limits<>
28   // follows below.
29
30   // In addition, various macros that are used for initializing
31   // floating-point literal values having specified widths and
32   // some basic min/max values are defined.
33
34   // First, we will pre-load certain preprocessor definitions
35   // with a dummy value.
36
37   #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH  0
38
39   #define BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE  0
40   #define BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE  0
41   #define BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE  0
42   #define BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE  0
43   #define BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE 0
44
45   // Ensure that the compiler has a radix-2 floating-point representation.
46   #if (!defined(FLT_RADIX) || ((defined(FLT_RADIX) && (FLT_RADIX != 2))))
47     #error The compiler does not support any radix-2 floating-point types required for <boost/cstdfloat.hpp>.
48   #endif
49
50   // Check if built-in float is equivalent to float16_t, float32_t, float64_t, float80_t, or float128_t.
51   #if(defined(FLT_MANT_DIG) && defined(FLT_MAX_EXP))
52     #if  ((FLT_MANT_DIG == 11) && (FLT_MAX_EXP == 16) && (BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE == 0))
53       #define BOOST_CSTDFLOAT_FLOAT16_NATIVE_TYPE float
54       #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
55       #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 16
56       #undef  BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE
57       #define BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE  1
58       #define BOOST_FLOAT16_C(x)  (x ## F)
59       #define BOOST_CSTDFLOAT_FLOAT_16_MIN  FLT_MIN
60       #define BOOST_CSTDFLOAT_FLOAT_16_MAX  FLT_MAX
61     #elif((FLT_MANT_DIG == 24) && (FLT_MAX_EXP == 128) && (BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE == 0))
62       #define BOOST_CSTDFLOAT_FLOAT32_NATIVE_TYPE float
63       #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
64       #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 32
65       #undef  BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE
66       #define BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE  1
67       #define BOOST_FLOAT32_C(x)  (x ## F)
68       #define BOOST_CSTDFLOAT_FLOAT_32_MIN  FLT_MIN
69       #define BOOST_CSTDFLOAT_FLOAT_32_MAX  FLT_MAX
70     #elif((FLT_MANT_DIG == 53) && (FLT_MAX_EXP == 1024) && (BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE == 0))
71       #define BOOST_CSTDFLOAT_FLOAT64_NATIVE_TYPE float
72       #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
73       #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 64
74       #undef  BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE
75       #define BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE  1
76       #define BOOST_FLOAT64_C(x)  (x ## F)
77       #define BOOST_CSTDFLOAT_FLOAT_64_MIN  FLT_MIN
78       #define BOOST_CSTDFLOAT_FLOAT_64_MAX  FLT_MAX
79     #elif((FLT_MANT_DIG == 64) && (FLT_MAX_EXP == 16384) && (BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE == 0))
80       #define BOOST_CSTDFLOAT_FLOAT80_NATIVE_TYPE float
81       #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
82       #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 80
83       #undef  BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE
84       #define BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE  1
85       #define BOOST_FLOAT80_C(x)  (x ## F)
86       #define BOOST_CSTDFLOAT_FLOAT_80_MIN  FLT_MIN
87       #define BOOST_CSTDFLOAT_FLOAT_80_MAX  FLT_MAX
88     #elif((FLT_MANT_DIG == 113) && (FLT_MAX_EXP == 16384) && (BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 0))
89       #define BOOST_CSTDFLOAT_FLOAT128_NATIVE_TYPE float
90       #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
91       #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 128
92       #undef  BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE
93       #define BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE  1
94       #define BOOST_FLOAT128_C(x)  (x ## F)
95       #define BOOST_CSTDFLOAT_FLOAT_128_MIN  FLT_MIN
96       #define BOOST_CSTDFLOAT_FLOAT_128_MAX  FLT_MAX
97     #endif
98   #endif
99
100   // Check if built-in double is equivalent to float16_t, float32_t, float64_t, float80_t, or float128_t.
101   #if(defined(DBL_MANT_DIG) && defined(DBL_MAX_EXP))
102     #if  ((DBL_MANT_DIG == 11) && (DBL_MAX_EXP == 16) && (BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE == 0))
103       #define BOOST_CSTDFLOAT_FLOAT16_NATIVE_TYPE double
104       #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
105       #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 16
106       #undef  BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE
107       #define BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE  1
108       #define BOOST_FLOAT16_C(x)  (x)
109       #define BOOST_CSTDFLOAT_FLOAT_16_MIN  DBL_MIN
110       #define BOOST_CSTDFLOAT_FLOAT_16_MAX  DBL_MAX
111     #elif((DBL_MANT_DIG == 24) && (DBL_MAX_EXP == 128) && (BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE == 0))
112       #define BOOST_CSTDFLOAT_FLOAT32_NATIVE_TYPE double
113       #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
114       #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 32
115       #undef  BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE
116       #define BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE  1
117       #define BOOST_FLOAT32_C(x)  (x)
118       #define BOOST_CSTDFLOAT_FLOAT_32_MIN  DBL_MIN
119       #define BOOST_CSTDFLOAT_FLOAT_32_MAX  DBL_MAX
120     #elif((DBL_MANT_DIG == 53) && (DBL_MAX_EXP == 1024) && (BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE == 0))
121       #define BOOST_CSTDFLOAT_FLOAT64_NATIVE_TYPE double
122       #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
123       #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 64
124       #undef  BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE
125       #define BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE  1
126       #define BOOST_FLOAT64_C(x)  (x)
127       #define BOOST_CSTDFLOAT_FLOAT_64_MIN  DBL_MIN
128       #define BOOST_CSTDFLOAT_FLOAT_64_MAX  DBL_MAX
129     #elif((DBL_MANT_DIG == 64) && (DBL_MAX_EXP == 16384) && (BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE == 0))
130       #define BOOST_CSTDFLOAT_FLOAT80_NATIVE_TYPE double
131       #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
132       #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 80
133       #undef  BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE
134       #define BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE  1
135       #define BOOST_FLOAT80_C(x)  (x)
136       #define BOOST_CSTDFLOAT_FLOAT_80_MIN  DBL_MIN
137       #define BOOST_CSTDFLOAT_FLOAT_80_MAX  DBL_MAX
138     #elif((DBL_MANT_DIG == 113) && (DBL_MAX_EXP == 16384) && (BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 0))
139       #define BOOST_CSTDFLOAT_FLOAT128_NATIVE_TYPE double
140       #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
141       #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 128
142       #undef  BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE
143       #define BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE  1
144       #define BOOST_FLOAT128_C(x)  (x)
145       #define BOOST_CSTDFLOAT_FLOAT_128_MIN  DBL_MIN
146       #define BOOST_CSTDFLOAT_FLOAT_128_MAX  DBL_MAX
147     #endif
148   #endif
149
150   // Disable check long double capability even if supported by compiler since some math runtime
151   // implementations are broken for long double.
152   #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
153     // Check if built-in long double is equivalent to float16_t, float32_t, float64_t, float80_t, or float128_t.
154     #if(defined(LDBL_MANT_DIG) && defined(LDBL_MAX_EXP))
155       #if  ((LDBL_MANT_DIG == 11) && (LDBL_MAX_EXP == 16) && (BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE == 0))
156         #define BOOST_CSTDFLOAT_FLOAT16_NATIVE_TYPE long double
157         #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
158         #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 16
159         #undef  BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE
160         #define BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE  1
161         #define BOOST_FLOAT16_C(x)  (x ## L)
162         #define BOOST_CSTDFLOAT_FLOAT_16_MIN  LDBL_MIN
163         #define BOOST_CSTDFLOAT_FLOAT_16_MAX  LDBL_MAX
164       #elif((LDBL_MANT_DIG == 24) && (LDBL_MAX_EXP == 128) && (BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE == 0))
165         #define BOOST_CSTDFLOAT_FLOAT32_NATIVE_TYPE long double
166         #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
167         #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 32
168         #undef  BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE
169         #define BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE  1
170         #define BOOST_FLOAT32_C(x)  (x ## L)
171         #define BOOST_CSTDFLOAT_FLOAT_32_MIN  LDBL_MIN
172         #define BOOST_CSTDFLOAT_FLOAT_32_MAX  LDBL_MAX
173       #elif((LDBL_MANT_DIG == 53) && (LDBL_MAX_EXP == 1024) && (BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE == 0))
174         #define BOOST_CSTDFLOAT_FLOAT64_NATIVE_TYPE long double
175         #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
176         #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 64
177         #undef  BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE
178         #define BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE  1
179         #define BOOST_FLOAT64_C(x)  (x ## L)
180         #define BOOST_CSTDFLOAT_FLOAT_64_MIN  LDBL_MIN
181         #define BOOST_CSTDFLOAT_FLOAT_64_MAX  LDBL_MAX
182       #elif((LDBL_MANT_DIG == 64) && (LDBL_MAX_EXP == 16384) && (BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE == 0))
183         #define BOOST_CSTDFLOAT_FLOAT80_NATIVE_TYPE long double
184         #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
185         #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 80
186         #undef  BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE
187         #define BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE  1
188         #define BOOST_FLOAT80_C(x)  (x ## L)
189         #define BOOST_CSTDFLOAT_FLOAT_80_MIN  LDBL_MIN
190         #define BOOST_CSTDFLOAT_FLOAT_80_MAX  LDBL_MAX
191       #elif((LDBL_MANT_DIG == 113) && (LDBL_MAX_EXP == 16384) && (BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 0))
192         #define BOOST_CSTDFLOAT_FLOAT128_NATIVE_TYPE long double
193         #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
194         #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 128
195         #undef  BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE
196         #define BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE  1
197         #define BOOST_FLOAT128_C(x)  (x ## L)
198         #define BOOST_CSTDFLOAT_FLOAT_128_MIN  LDBL_MIN
199         #define BOOST_CSTDFLOAT_FLOAT_128_MAX  LDBL_MAX
200       #endif
201     #endif
202   #endif
203
204   // Check if quadruple-precision is supported. Here, we are checking
205   // for the presence of __float128 from GCC's quadmath.h or _Quad
206   // from ICC's /Qlong-double flag). To query these, we use the
207   // BOOST_MATH_USE_FLOAT128 pre-processor definition from
208   // <boost/math/tools/config.hpp>.
209
210   #if (BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 0) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT)
211
212     // Specify the underlying name of the internal 128-bit floating-point type definition.
213     namespace boost { namespace math { namespace cstdfloat { namespace detail {
214     #if defined(__GNUC__)
215       typedef __float128      float_internal128_t;
216     #elif defined(BOOST_INTEL)
217       typedef _Quad           float_internal128_t;
218     #else
219       #error "Sorry, the compiler is neither GCC, nor Intel, I don't know how to configure <boost/cstdfloat.hpp>."
220     #endif
221     } } } } // boost::math::cstdfloat::detail
222
223     #define BOOST_CSTDFLOAT_FLOAT128_NATIVE_TYPE boost::math::cstdfloat::detail::float_internal128_t
224     #undef  BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
225     #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 128
226     #undef  BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE
227     #define BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE  1
228     #define BOOST_FLOAT128_C(x)  (x ## Q)
229     #define BOOST_CSTDFLOAT_FLOAT128_MIN  3.36210314311209350626267781732175260e-4932Q
230     #define BOOST_CSTDFLOAT_FLOAT128_MAX  1.18973149535723176508575932662800702e+4932Q
231     #define BOOST_CSTDFLOAT_FLOAT128_EPS  1.92592994438723585305597794258492732e-0034Q
232     #define BOOST_CSTDFLOAT_FLOAT128_DENORM_MIN  6.475175119438025110924438958227646552e-4966Q
233
234   #endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support)
235
236   // This is the end of the preamble, and also the end of the
237   // sections providing support for the C++ standard library
238   // for quadruple-precision.
239
240   // Now we use the results of the queries that have been obtained
241   // in the preamble (far above) for the final type definitions in
242   // the namespace boost.
243
244   // Make sure that the compiler has any floating-point type(s) whatsoever.
245   #if (   (BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE  == 0)  \
246        && (BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE  == 0)  \
247        && (BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE  == 0)  \
248        && (BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE  == 0)  \
249        && (BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 0))
250     #error The compiler does not support any of the floating-point types required for <boost/cstdfloat.hpp>.
251   #endif
252
253   // The following section contains the various min/max macros
254   // for the *leastN and *fastN types.
255
256   #if(BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE == 1)
257     #define BOOST_FLOAT_FAST16_MIN   BOOST_CSTDFLOAT_FLOAT_16_MIN
258     #define BOOST_FLOAT_LEAST16_MIN  BOOST_CSTDFLOAT_FLOAT_16_MIN
259     #define BOOST_FLOAT_FAST16_MAX   BOOST_CSTDFLOAT_FLOAT_16_MAX
260     #define BOOST_FLOAT_LEAST16_MAX  BOOST_CSTDFLOAT_FLOAT_16_MAX
261   #endif
262
263   #if(BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE == 1)
264     #define BOOST_FLOAT_FAST32_MIN   BOOST_CSTDFLOAT_FLOAT_32_MIN
265     #define BOOST_FLOAT_LEAST32_MIN  BOOST_CSTDFLOAT_FLOAT_32_MIN
266     #define BOOST_FLOAT_FAST32_MAX   BOOST_CSTDFLOAT_FLOAT_32_MAX
267     #define BOOST_FLOAT_LEAST32_MAX  BOOST_CSTDFLOAT_FLOAT_32_MAX
268   #endif
269
270   #if(BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE == 1)
271     #define BOOST_FLOAT_FAST64_MIN   BOOST_CSTDFLOAT_FLOAT_64_MIN
272     #define BOOST_FLOAT_LEAST64_MIN  BOOST_CSTDFLOAT_FLOAT_64_MIN
273     #define BOOST_FLOAT_FAST64_MAX   BOOST_CSTDFLOAT_FLOAT_64_MAX
274     #define BOOST_FLOAT_LEAST64_MAX  BOOST_CSTDFLOAT_FLOAT_64_MAX
275   #endif
276
277   #if(BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE == 1)
278     #define BOOST_FLOAT_FAST80_MIN   BOOST_CSTDFLOAT_FLOAT_80_MIN
279     #define BOOST_FLOAT_LEAST80_MIN  BOOST_CSTDFLOAT_FLOAT_80_MIN
280     #define BOOST_FLOAT_FAST80_MAX   BOOST_CSTDFLOAT_FLOAT_80_MAX
281     #define BOOST_FLOAT_LEAST80_MAX  BOOST_CSTDFLOAT_FLOAT_80_MAX
282   #endif
283
284   #if(BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 1)
285     #define BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T
286
287     #define BOOST_FLOAT_FAST128_MIN   BOOST_CSTDFLOAT_FLOAT_128_MIN
288     #define BOOST_FLOAT_LEAST128_MIN  BOOST_CSTDFLOAT_FLOAT_128_MIN
289     #define BOOST_FLOAT_FAST128_MAX   BOOST_CSTDFLOAT_FLOAT_128_MAX
290     #define BOOST_FLOAT_LEAST128_MAX  BOOST_CSTDFLOAT_FLOAT_128_MAX
291   #endif
292
293   // The following section contains the various min/max macros
294   // for the *floatmax types.
295
296   #if  (BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 16)
297     #define BOOST_FLOATMAX_C(x) BOOST_FLOAT16_C(x)
298     #define BOOST_FLOATMAX_MIN  BOOST_CSTDFLOAT_FLOAT_16_MIN
299     #define BOOST_FLOATMAX_MAX  BOOST_CSTDFLOAT_FLOAT_16_MAX
300   #elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 32)
301     #define BOOST_FLOATMAX_C(x) BOOST_FLOAT32_C(x)
302     #define BOOST_FLOATMAX_MIN  BOOST_CSTDFLOAT_FLOAT_32_MIN
303     #define BOOST_FLOATMAX_MAX  BOOST_CSTDFLOAT_FLOAT_32_MAX
304   #elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 64)
305     #define BOOST_FLOATMAX_C(x) BOOST_FLOAT64_C(x)
306     #define BOOST_FLOATMAX_MIN  BOOST_CSTDFLOAT_FLOAT_64_MIN
307     #define BOOST_FLOATMAX_MAX  BOOST_CSTDFLOAT_FLOAT_64_MAX
308   #elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 80)
309     #define BOOST_FLOATMAX_C(x) BOOST_FLOAT80_C(x)
310     #define BOOST_FLOATMAX_MIN  BOOST_CSTDFLOAT_FLOAT_80_MIN
311     #define BOOST_FLOATMAX_MAX  BOOST_CSTDFLOAT_FLOAT_80_MAX
312   #elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 128)
313     #define BOOST_FLOATMAX_C(x) BOOST_FLOAT128_C(x)
314     #define BOOST_FLOATMAX_MIN  BOOST_CSTDFLOAT_FLOAT_128_MIN
315     #define BOOST_FLOATMAX_MAX  BOOST_CSTDFLOAT_FLOAT_128_MAX
316   #else
317     #error The maximum available floating-point width for <boost/cstdfloat.hpp> is undefined.
318   #endif
319
320   // And finally..., we define the floating-point typedefs having
321   // specified widths. The types are defined in the namespace boost.
322
323   // For simplicity, the least and fast types are type defined identically
324   // as the corresponding fixed-width type. This behavior may, however,
325   // be modified when being optimized for a given compiler implementation.
326
327   // In addition, a clear assessment of IEEE-754 comformance is carried out
328   // using compile-time assertion.
329
330   namespace boost
331   {
332     #if(BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE == 1)
333       typedef BOOST_CSTDFLOAT_FLOAT16_NATIVE_TYPE float16_t;
334       typedef boost::float16_t float_fast16_t;
335       typedef boost::float16_t float_least16_t;
336
337       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float16_t>::is_iec559    == true, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
338       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float16_t>::radix        ==    2, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
339       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float16_t>::digits       ==   11, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
340       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float16_t>::max_exponent ==   16, "boost::float16_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
341
342       #undef BOOST_CSTDFLOAT_FLOAT_16_MIN
343       #undef BOOST_CSTDFLOAT_FLOAT_16_MAX
344     #endif
345
346     #if(BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE == 1)
347       typedef BOOST_CSTDFLOAT_FLOAT32_NATIVE_TYPE float32_t;
348       typedef boost::float32_t float_fast32_t;
349       typedef boost::float32_t float_least32_t;
350
351       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float32_t>::is_iec559    == true, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
352       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float32_t>::radix        ==    2, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
353       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float32_t>::digits       ==   24, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
354       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float32_t>::max_exponent ==  128, "boost::float32_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
355
356       #undef BOOST_CSTDFLOAT_FLOAT_32_MIN
357       #undef BOOST_CSTDFLOAT_FLOAT_32_MAX
358     #endif
359
360 #if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && defined(__SUNPRO_CC)
361 #undef BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE
362 #define BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE 0
363 #undef BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE
364 #define BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE 0
365 #undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
366 #define BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH 64
367 #endif
368
369     #if(BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE == 1)
370       typedef BOOST_CSTDFLOAT_FLOAT64_NATIVE_TYPE float64_t;
371       typedef boost::float64_t float_fast64_t;
372       typedef boost::float64_t float_least64_t;
373
374       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float64_t>::is_iec559    == true, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
375       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float64_t>::radix        ==    2, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
376       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float64_t>::digits       ==   53, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
377       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float64_t>::max_exponent == 1024, "boost::float64_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
378
379       #undef BOOST_CSTDFLOAT_FLOAT_64_MIN
380       #undef BOOST_CSTDFLOAT_FLOAT_64_MAX
381     #endif
382
383     #if(BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE == 1)
384       typedef BOOST_CSTDFLOAT_FLOAT80_NATIVE_TYPE float80_t;
385       typedef boost::float80_t float_fast80_t;
386       typedef boost::float80_t float_least80_t;
387
388       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float80_t>::is_iec559    ==  true, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
389       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float80_t>::radix        ==     2, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
390       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float80_t>::digits       ==    64, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
391       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float80_t>::max_exponent == 16384, "boost::float80_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
392
393       #undef BOOST_CSTDFLOAT_FLOAT_80_MIN
394       #undef BOOST_CSTDFLOAT_FLOAT_80_MAX
395     #endif
396
397     #if(BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE == 1)
398       typedef BOOST_CSTDFLOAT_FLOAT128_NATIVE_TYPE float128_t;
399       typedef boost::float128_t float_fast128_t;
400       typedef boost::float128_t float_least128_t;
401
402       #if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT)
403       // This configuration does not *yet* support std::numeric_limits<boost::float128_t>.
404       // Support for std::numeric_limits<boost::float128_t> is added in the detail
405       // file <boost/math/cstdfloat/cstdfloat_limits.hpp>.
406       #else
407       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float128_t>::is_iec559    ==  true, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
408       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float128_t>::radix        ==     2, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
409       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float128_t>::digits       ==   113, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
410       BOOST_STATIC_ASSERT_MSG(std::numeric_limits<boost::float128_t>::max_exponent == 16384, "boost::float128_t has been detected in <boost/cstdfloat>, but verification with std::numeric_limits fails");
411       #endif
412
413       #undef BOOST_CSTDFLOAT_FLOAT_128_MIN
414       #undef BOOST_CSTDFLOAT_FLOAT_128_MAX
415     #endif
416
417     #if  (BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH ==  16)
418       typedef boost::float16_t  floatmax_t;
419     #elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH ==  32)
420       typedef boost::float32_t  floatmax_t;
421     #elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH ==  64)
422       typedef boost::float64_t  floatmax_t;
423     #elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH ==  80)
424       typedef boost::float80_t  floatmax_t;
425     #elif(BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH == 128)
426       typedef boost::float128_t floatmax_t;
427     #else
428       #error The maximum available floating-point width for <boost/cstdfloat.hpp> is undefined.
429     #endif
430
431     #undef BOOST_CSTDFLOAT_HAS_FLOAT16_NATIVE_TYPE
432     #undef BOOST_CSTDFLOAT_HAS_FLOAT32_NATIVE_TYPE
433     #undef BOOST_CSTDFLOAT_HAS_FLOAT64_NATIVE_TYPE
434     #undef BOOST_CSTDFLOAT_HAS_FLOAT80_NATIVE_TYPE
435     #undef BOOST_CSTDFLOAT_HAS_FLOAT128_NATIVE_TYPE
436
437     #undef BOOST_CSTDFLOAT_MAXIMUM_AVAILABLE_WIDTH
438   }
439   // namespace boost
440
441 #endif // _BOOST_CSTDFLOAT_BASE_TYPES_2014_01_09_HPP_
442