blob: eff178ac45895ec962c22f117435f2d9c9658369 [file] [log] [blame]
Jeff Thompsonef2d5a42013-08-22 19:09:24 -07001// fp_traits.hpp
2
Jeff Thompson3d613fd2013-10-15 15:39:04 -07003#ifndef NDNBOOST_MATH_FP_TRAITS_HPP
4#define NDNBOOST_MATH_FP_TRAITS_HPP
Jeff Thompsonef2d5a42013-08-22 19:09:24 -07005
6// Copyright (c) 2006 Johan Rade
7
8// Distributed under the Boost Software License, Version 1.0.
9// (See accompanying file LICENSE_1_0.txt
10// or copy at http://www.boost.org/LICENSE_1_0.txt)
11
12/*
13To support old compilers, care has been taken to avoid partial template
14specialization and meta function forwarding.
15With these techniques, the code could be simplified.
16*/
17
18#if defined(__vms) && defined(__DECCXX) && !__IEEE_FLOAT
19// The VAX floating point formats are used (for float and double)
Jeff Thompson3d613fd2013-10-15 15:39:04 -070020# define NDNBOOST_FPCLASSIFY_VAX_FORMAT
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070021#endif
22
23#include <cstring>
24
25#include <ndnboost/assert.hpp>
26#include <ndnboost/cstdint.hpp>
27#include <ndnboost/detail/endian.hpp>
28#include <ndnboost/static_assert.hpp>
29#include <ndnboost/type_traits/is_floating_point.hpp>
30
Jeff Thompson3d613fd2013-10-15 15:39:04 -070031#ifdef NDNBOOST_NO_STDC_NAMESPACE
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070032 namespace std{ using ::memcpy; }
33#endif
34
35#ifndef FP_NORMAL
36
37#define FP_ZERO 0
38#define FP_NORMAL 1
39#define FP_INFINITE 2
40#define FP_NAN 3
41#define FP_SUBNORMAL 4
42
43#else
44
Jeff Thompson3d613fd2013-10-15 15:39:04 -070045#define NDNBOOST_HAS_FPCLASSIFY
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070046
47#ifndef fpclassify
48# if (defined(__GLIBCPP__) || defined(__GLIBCXX__)) \
49 && defined(_GLIBCXX_USE_C99_MATH) \
50 && !(defined(_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC) \
51 && (_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC != 0))
52# ifdef _STLP_VENDOR_CSTD
53# if _STLPORT_VERSION >= 0x520
Jeff Thompson3d613fd2013-10-15 15:39:04 -070054# define NDNBOOST_FPCLASSIFY_PREFIX ::__std_alias::
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070055# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070056# define NDNBOOST_FPCLASSIFY_PREFIX ::_STLP_VENDOR_CSTD::
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070057# endif
58# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070059# define NDNBOOST_FPCLASSIFY_PREFIX ::std::
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070060# endif
61# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070062# undef NDNBOOST_HAS_FPCLASSIFY
63# define NDNBOOST_FPCLASSIFY_PREFIX
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070064# endif
65#elif (defined(__HP_aCC) && !defined(__hppa))
66// aCC 6 appears to do "#define fpclassify fpclassify" which messes us up a bit!
Jeff Thompson3d613fd2013-10-15 15:39:04 -070067# define NDNBOOST_FPCLASSIFY_PREFIX ::
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070068#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070069# define NDNBOOST_FPCLASSIFY_PREFIX
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070070#endif
71
72#ifdef __MINGW32__
Jeff Thompson3d613fd2013-10-15 15:39:04 -070073# undef NDNBOOST_HAS_FPCLASSIFY
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070074#endif
75
76#endif
77
78
79//------------------------------------------------------------------------------
80
81namespace ndnboost {
82namespace math {
83namespace detail {
84
85//------------------------------------------------------------------------------
86
87/*
88The following classes are used to tag the different methods that are used
89for floating point classification
90*/
91
92struct native_tag {};
93template <bool has_limits>
94struct generic_tag {};
95struct ieee_tag {};
96struct ieee_copy_all_bits_tag : public ieee_tag {};
97struct ieee_copy_leading_bits_tag : public ieee_tag {};
98
Jeff Thompson3d613fd2013-10-15 15:39:04 -070099#ifdef NDNBOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700100//
101// These helper functions are used only when numeric_limits<>
102// members are not compile time constants:
103//
104inline bool is_generic_tag_false(const generic_tag<false>*)
105{
106 return true;
107}
108inline bool is_generic_tag_false(const void*)
109{
110 return false;
111}
112#endif
113
114//------------------------------------------------------------------------------
115
116/*
117Most processors support three different floating point precisions:
118single precision (32 bits), double precision (64 bits)
119and extended double precision (80 - 128 bits, depending on the processor)
120
121Note that the C++ type long double can be implemented
122both as double precision and extended double precision.
123*/
124
125struct unknown_precision{};
126struct single_precision {};
127struct double_precision {};
128struct extended_double_precision {};
129
130// native_tag version --------------------------------------------------------------
131
132template<class T> struct fp_traits_native
133{
134 typedef native_tag method;
135};
136
137// generic_tag version -------------------------------------------------------------
138
139template<class T, class U> struct fp_traits_non_native
140{
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700141#ifndef NDNBOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700142 typedef generic_tag<std::numeric_limits<T>::is_specialized> method;
143#else
144 typedef generic_tag<false> method;
145#endif
146};
147
148// ieee_tag versions ---------------------------------------------------------------
149
150/*
151These specializations of fp_traits_non_native contain information needed
152to "parse" the binary representation of a floating point number.
153
154Typedef members:
155
156 bits -- the target type when copying the leading bytes of a floating
157 point number. It is a typedef for uint32_t or uint64_t.
158
159 method -- tells us whether all bytes are copied or not.
160 It is a typedef for ieee_copy_all_bits_tag or ieee_copy_leading_bits_tag.
161
162Static data members:
163
164 sign, exponent, flag, significand -- bit masks that give the meaning of the
165 bits in the leading bytes.
166
167Static function members:
168
169 get_bits(), set_bits() -- provide access to the leading bytes.
170
171*/
172
173// ieee_tag version, float (32 bits) -----------------------------------------------
174
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700175#ifndef NDNBOOST_FPCLASSIFY_VAX_FORMAT
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700176
177template<> struct fp_traits_non_native<float, single_precision>
178{
179 typedef ieee_copy_all_bits_tag method;
180
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700181 NDNBOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u);
182 NDNBOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7f800000);
183 NDNBOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000);
184 NDNBOOST_STATIC_CONSTANT(uint32_t, significand = 0x007fffff);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700185
186 typedef uint32_t bits;
187 static void get_bits(float x, uint32_t& a) { std::memcpy(&a, &x, 4); }
188 static void set_bits(float& x, uint32_t a) { std::memcpy(&x, &a, 4); }
189};
190
191// ieee_tag version, double (64 bits) ----------------------------------------------
192
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700193#if defined(NDNBOOST_NO_INT64_T) || defined(NDNBOOST_NO_INCLASS_MEMBER_INITIALIZATION) \
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700194 || defined(__BORLANDC__) || defined(__CODEGEAR__)
195
196template<> struct fp_traits_non_native<double, double_precision>
197{
198 typedef ieee_copy_leading_bits_tag method;
199
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700200 NDNBOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u);
201 NDNBOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000);
202 NDNBOOST_STATIC_CONSTANT(uint32_t, flag = 0);
203 NDNBOOST_STATIC_CONSTANT(uint32_t, significand = 0x000fffff);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700204
205 typedef uint32_t bits;
206
207 static void get_bits(double x, uint32_t& a)
208 {
209 std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4);
210 }
211
212 static void set_bits(double& x, uint32_t a)
213 {
214 std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
215 }
216
217private:
218
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700219#if defined(NDNBOOST_BIG_ENDIAN)
220 NDNBOOST_STATIC_CONSTANT(int, offset_ = 0);
221#elif defined(NDNBOOST_LITTLE_ENDIAN)
222 NDNBOOST_STATIC_CONSTANT(int, offset_ = 4);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700223#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700224 NDNBOOST_STATIC_ASSERT(false);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700225#endif
226};
227
228//..............................................................................
229
230#else
231
232template<> struct fp_traits_non_native<double, double_precision>
233{
234 typedef ieee_copy_all_bits_tag method;
235
236 static const uint64_t sign = ((uint64_t)0x80000000u) << 32;
237 static const uint64_t exponent = ((uint64_t)0x7ff00000) << 32;
238 static const uint64_t flag = 0;
239 static const uint64_t significand
240 = (((uint64_t)0x000fffff) << 32) + ((uint64_t)0xffffffffu);
241
242 typedef uint64_t bits;
243 static void get_bits(double x, uint64_t& a) { std::memcpy(&a, &x, 8); }
244 static void set_bits(double& x, uint64_t a) { std::memcpy(&x, &a, 8); }
245};
246
247#endif
248
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700249#endif // #ifndef NDNBOOST_FPCLASSIFY_VAX_FORMAT
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700250
251// long double (64 bits) -------------------------------------------------------
252
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700253#if defined(NDNBOOST_NO_INT64_T) || defined(NDNBOOST_NO_INCLASS_MEMBER_INITIALIZATION)\
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700254 || defined(__BORLANDC__) || defined(__CODEGEAR__)
255
256template<> struct fp_traits_non_native<long double, double_precision>
257{
258 typedef ieee_copy_leading_bits_tag method;
259
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700260 NDNBOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u);
261 NDNBOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000);
262 NDNBOOST_STATIC_CONSTANT(uint32_t, flag = 0);
263 NDNBOOST_STATIC_CONSTANT(uint32_t, significand = 0x000fffff);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700264
265 typedef uint32_t bits;
266
267 static void get_bits(long double x, uint32_t& a)
268 {
269 std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4);
270 }
271
272 static void set_bits(long double& x, uint32_t a)
273 {
274 std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
275 }
276
277private:
278
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700279#if defined(NDNBOOST_BIG_ENDIAN)
280 NDNBOOST_STATIC_CONSTANT(int, offset_ = 0);
281#elif defined(NDNBOOST_LITTLE_ENDIAN)
282 NDNBOOST_STATIC_CONSTANT(int, offset_ = 4);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700283#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700284 NDNBOOST_STATIC_ASSERT(false);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700285#endif
286};
287
288//..............................................................................
289
290#else
291
292template<> struct fp_traits_non_native<long double, double_precision>
293{
294 typedef ieee_copy_all_bits_tag method;
295
296 static const uint64_t sign = (uint64_t)0x80000000u << 32;
297 static const uint64_t exponent = (uint64_t)0x7ff00000 << 32;
298 static const uint64_t flag = 0;
299 static const uint64_t significand
300 = ((uint64_t)0x000fffff << 32) + (uint64_t)0xffffffffu;
301
302 typedef uint64_t bits;
303 static void get_bits(long double x, uint64_t& a) { std::memcpy(&a, &x, 8); }
304 static void set_bits(long double& x, uint64_t a) { std::memcpy(&x, &a, 8); }
305};
306
307#endif
308
309
310// long double (>64 bits), x86 and x64 -----------------------------------------
311
312#if defined(__i386) || defined(__i386__) || defined(_M_IX86) \
313 || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) \
314 || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)
315
316// Intel extended double precision format (80 bits)
317
318template<>
319struct fp_traits_non_native<long double, extended_double_precision>
320{
321 typedef ieee_copy_leading_bits_tag method;
322
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700323 NDNBOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u);
324 NDNBOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000);
325 NDNBOOST_STATIC_CONSTANT(uint32_t, flag = 0x00008000);
326 NDNBOOST_STATIC_CONSTANT(uint32_t, significand = 0x00007fff);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700327
328 typedef uint32_t bits;
329
330 static void get_bits(long double x, uint32_t& a)
331 {
332 std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + 6, 4);
333 }
334
335 static void set_bits(long double& x, uint32_t a)
336 {
337 std::memcpy(reinterpret_cast<unsigned char*>(&x) + 6, &a, 4);
338 }
339};
340
341
342// long double (>64 bits), Itanium ---------------------------------------------
343
344#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
345
346// The floating point format is unknown at compile time
347// No template specialization is provided.
348// The generic_tag definition is used.
349
350// The Itanium supports both
351// the Intel extended double precision format (80 bits) and
352// the IEEE extended double precision format with 15 exponent bits (128 bits).
353
354
355// long double (>64 bits), PowerPC ---------------------------------------------
356
357#elif defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) \
358 || defined(__ppc) || defined(__ppc__) || defined(__PPC__)
359
360// PowerPC extended double precision format (128 bits)
361
362template<>
363struct fp_traits_non_native<long double, extended_double_precision>
364{
365 typedef ieee_copy_leading_bits_tag method;
366
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700367 NDNBOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u);
368 NDNBOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000);
369 NDNBOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000);
370 NDNBOOST_STATIC_CONSTANT(uint32_t, significand = 0x000fffff);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700371
372 typedef uint32_t bits;
373
374 static void get_bits(long double x, uint32_t& a)
375 {
376 std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4);
377 }
378
379 static void set_bits(long double& x, uint32_t a)
380 {
381 std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
382 }
383
384private:
385
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700386#if defined(NDNBOOST_BIG_ENDIAN)
387 NDNBOOST_STATIC_CONSTANT(int, offset_ = 0);
388#elif defined(NDNBOOST_LITTLE_ENDIAN)
389 NDNBOOST_STATIC_CONSTANT(int, offset_ = 12);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700390#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700391 NDNBOOST_STATIC_ASSERT(false);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700392#endif
393};
394
395
396// long double (>64 bits), Motorola 68K ----------------------------------------
397
398#elif defined(__m68k) || defined(__m68k__) \
399 || defined(__mc68000) || defined(__mc68000__) \
400
401// Motorola extended double precision format (96 bits)
402
403// It is the same format as the Intel extended double precision format,
404// except that 1) it is big-endian, 2) the 3rd and 4th byte are padding, and
405// 3) the flag bit is not set for infinity
406
407template<>
408struct fp_traits_non_native<long double, extended_double_precision>
409{
410 typedef ieee_copy_leading_bits_tag method;
411
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700412 NDNBOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u);
413 NDNBOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000);
414 NDNBOOST_STATIC_CONSTANT(uint32_t, flag = 0x00008000);
415 NDNBOOST_STATIC_CONSTANT(uint32_t, significand = 0x00007fff);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700416
417 // copy 1st, 2nd, 5th and 6th byte. 3rd and 4th byte are padding.
418
419 typedef uint32_t bits;
420
421 static void get_bits(long double x, uint32_t& a)
422 {
423 std::memcpy(&a, &x, 2);
424 std::memcpy(reinterpret_cast<unsigned char*>(&a) + 2,
425 reinterpret_cast<const unsigned char*>(&x) + 4, 2);
426 }
427
428 static void set_bits(long double& x, uint32_t a)
429 {
430 std::memcpy(&x, &a, 2);
431 std::memcpy(reinterpret_cast<unsigned char*>(&x) + 4,
432 reinterpret_cast<const unsigned char*>(&a) + 2, 2);
433 }
434};
435
436
437// long double (>64 bits), All other processors --------------------------------
438
439#else
440
441// IEEE extended double precision format with 15 exponent bits (128 bits)
442
443template<>
444struct fp_traits_non_native<long double, extended_double_precision>
445{
446 typedef ieee_copy_leading_bits_tag method;
447
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700448 NDNBOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u);
449 NDNBOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000);
450 NDNBOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000);
451 NDNBOOST_STATIC_CONSTANT(uint32_t, significand = 0x0000ffff);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700452
453 typedef uint32_t bits;
454
455 static void get_bits(long double x, uint32_t& a)
456 {
457 std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4);
458 }
459
460 static void set_bits(long double& x, uint32_t a)
461 {
462 std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4);
463 }
464
465private:
466
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700467#if defined(NDNBOOST_BIG_ENDIAN)
468 NDNBOOST_STATIC_CONSTANT(int, offset_ = 0);
469#elif defined(NDNBOOST_LITTLE_ENDIAN)
470 NDNBOOST_STATIC_CONSTANT(int, offset_ = 12);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700471#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700472 NDNBOOST_STATIC_ASSERT(false);
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700473#endif
474};
475
476#endif
477
478//------------------------------------------------------------------------------
479
480// size_to_precision is a type switch for converting a C++ floating point type
481// to the corresponding precision type.
482
483template<int n, bool fp> struct size_to_precision
484{
485 typedef unknown_precision type;
486};
487
488template<> struct size_to_precision<4, true>
489{
490 typedef single_precision type;
491};
492
493template<> struct size_to_precision<8, true>
494{
495 typedef double_precision type;
496};
497
498template<> struct size_to_precision<10, true>
499{
500 typedef extended_double_precision type;
501};
502
503template<> struct size_to_precision<12, true>
504{
505 typedef extended_double_precision type;
506};
507
508template<> struct size_to_precision<16, true>
509{
510 typedef extended_double_precision type;
511};
512
513//------------------------------------------------------------------------------
514//
515// Figure out whether to use native classification functions based on
516// whether T is a built in floating point type or not:
517//
518template <class T>
519struct select_native
520{
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700521 typedef NDNBOOST_DEDUCED_TYPENAME size_to_precision<sizeof(T), ::ndnboost::is_floating_point<T>::value>::type precision;
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700522 typedef fp_traits_non_native<T, precision> type;
523};
524template<>
525struct select_native<float>
526{
527 typedef fp_traits_native<float> type;
528};
529template<>
530struct select_native<double>
531{
532 typedef fp_traits_native<double> type;
533};
534template<>
535struct select_native<long double>
536{
537 typedef fp_traits_native<long double> type;
538};
539
540//------------------------------------------------------------------------------
541
542// fp_traits is a type switch that selects the right fp_traits_non_native
543
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700544#if (defined(NDNBOOST_MATH_USE_C99) && !(defined(__GNUC__) && (__GNUC__ < 4))) \
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700545 && !defined(__hpux) \
546 && !defined(__DECCXX)\
547 && !defined(__osf__) \
548 && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)\
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700549 && !defined(NDNBOOST_MATH_DISABLE_STD_FPCLASSIFY)
550# define NDNBOOST_MATH_USE_STD_FPCLASSIFY
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700551#endif
552
553template<class T> struct fp_traits
554{
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700555 typedef NDNBOOST_DEDUCED_TYPENAME size_to_precision<sizeof(T), ::ndnboost::is_floating_point<T>::value>::type precision;
556#if defined(NDNBOOST_MATH_USE_STD_FPCLASSIFY) && !defined(NDNBOOST_MATH_DISABLE_STD_FPCLASSIFY)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -0700557 typedef typename select_native<T>::type type;
558#else
559 typedef fp_traits_non_native<T, precision> type;
560#endif
561 typedef fp_traits_non_native<T, precision> sign_change_type;
562};
563
564//------------------------------------------------------------------------------
565
566} // namespace detail
567} // namespace math
568} // namespace ndnboost
569
570#endif