limits 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. // -*- C++ -*-
  2. //===---------------------------- limits ----------------------------------===//
  3. //
  4. // The LLVM Compiler Infrastructure
  5. //
  6. // This file is dual licensed under the MIT and the University of Illinois Open
  7. // Source Licenses. See LICENSE.TXT for details.
  8. //
  9. //===----------------------------------------------------------------------===//
  10. #ifndef _LIBCPP_LIMITS
  11. #define _LIBCPP_LIMITS
  12. /*
  13. limits synopsis
  14. namespace std
  15. {
  16. template<class T>
  17. class numeric_limits
  18. {
  19. public:
  20. static constexpr bool is_specialized = false;
  21. static constexpr T min() noexcept;
  22. static constexpr T max() noexcept;
  23. static constexpr T lowest() noexcept;
  24. static constexpr int digits = 0;
  25. static constexpr int digits10 = 0;
  26. static constexpr int max_digits10 = 0;
  27. static constexpr bool is_signed = false;
  28. static constexpr bool is_integer = false;
  29. static constexpr bool is_exact = false;
  30. static constexpr int radix = 0;
  31. static constexpr T epsilon() noexcept;
  32. static constexpr T round_error() noexcept;
  33. static constexpr int min_exponent = 0;
  34. static constexpr int min_exponent10 = 0;
  35. static constexpr int max_exponent = 0;
  36. static constexpr int max_exponent10 = 0;
  37. static constexpr bool has_infinity = false;
  38. static constexpr bool has_quiet_NaN = false;
  39. static constexpr bool has_signaling_NaN = false;
  40. static constexpr float_denorm_style has_denorm = denorm_absent;
  41. static constexpr bool has_denorm_loss = false;
  42. static constexpr T infinity() noexcept;
  43. static constexpr T quiet_NaN() noexcept;
  44. static constexpr T signaling_NaN() noexcept;
  45. static constexpr T denorm_min() noexcept;
  46. static constexpr bool is_iec559 = false;
  47. static constexpr bool is_bounded = false;
  48. static constexpr bool is_modulo = false;
  49. static constexpr bool traps = false;
  50. static constexpr bool tinyness_before = false;
  51. static constexpr float_round_style round_style = round_toward_zero;
  52. };
  53. enum float_round_style
  54. {
  55. round_indeterminate = -1,
  56. round_toward_zero = 0,
  57. round_to_nearest = 1,
  58. round_toward_infinity = 2,
  59. round_toward_neg_infinity = 3
  60. };
  61. enum float_denorm_style
  62. {
  63. denorm_indeterminate = -1,
  64. denorm_absent = 0,
  65. denorm_present = 1
  66. };
  67. template<> class numeric_limits<cv bool>;
  68. template<> class numeric_limits<cv char>;
  69. template<> class numeric_limits<cv signed char>;
  70. template<> class numeric_limits<cv unsigned char>;
  71. template<> class numeric_limits<cv wchar_t>;
  72. template<> class numeric_limits<cv char16_t>;
  73. template<> class numeric_limits<cv char32_t>;
  74. template<> class numeric_limits<cv short>;
  75. template<> class numeric_limits<cv int>;
  76. template<> class numeric_limits<cv long>;
  77. template<> class numeric_limits<cv long long>;
  78. template<> class numeric_limits<cv unsigned short>;
  79. template<> class numeric_limits<cv unsigned int>;
  80. template<> class numeric_limits<cv unsigned long>;
  81. template<> class numeric_limits<cv unsigned long long>;
  82. template<> class numeric_limits<cv float>;
  83. template<> class numeric_limits<cv double>;
  84. template<> class numeric_limits<cv long double>;
  85. } // std
  86. */
  87. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  88. #pragma GCC system_header
  89. #endif
  90. #include <__config>
  91. #include <type_traits>
  92. #include <__undef_min_max>
  93. #if defined(_LIBCPP_MSVCRT)
  94. #include "support/win32/limits_win32.h"
  95. #endif // _LIBCPP_MSVCRT
  96. #if defined(__IBMCPP__)
  97. #include "support/ibm/limits.h"
  98. #endif // __IBMCPP__
  99. _LIBCPP_BEGIN_NAMESPACE_STD
  100. enum float_round_style
  101. {
  102. round_indeterminate = -1,
  103. round_toward_zero = 0,
  104. round_to_nearest = 1,
  105. round_toward_infinity = 2,
  106. round_toward_neg_infinity = 3
  107. };
  108. enum float_denorm_style
  109. {
  110. denorm_indeterminate = -1,
  111. denorm_absent = 0,
  112. denorm_present = 1
  113. };
  114. template <class _Tp, bool = is_arithmetic<_Tp>::value>
  115. class __libcpp_numeric_limits
  116. {
  117. protected:
  118. typedef _Tp type;
  119. static _LIBCPP_CONSTEXPR const bool is_specialized = false;
  120. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return type();}
  121. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return type();}
  122. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return type();}
  123. static _LIBCPP_CONSTEXPR const int digits = 0;
  124. static _LIBCPP_CONSTEXPR const int digits10 = 0;
  125. static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
  126. static _LIBCPP_CONSTEXPR const bool is_signed = false;
  127. static _LIBCPP_CONSTEXPR const bool is_integer = false;
  128. static _LIBCPP_CONSTEXPR const bool is_exact = false;
  129. static _LIBCPP_CONSTEXPR const int radix = 0;
  130. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type();}
  131. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type();}
  132. static _LIBCPP_CONSTEXPR const int min_exponent = 0;
  133. static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
  134. static _LIBCPP_CONSTEXPR const int max_exponent = 0;
  135. static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
  136. static _LIBCPP_CONSTEXPR const bool has_infinity = false;
  137. static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
  138. static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
  139. static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
  140. static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
  141. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type();}
  142. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type();}
  143. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type();}
  144. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type();}
  145. static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
  146. static _LIBCPP_CONSTEXPR const bool is_bounded = false;
  147. static _LIBCPP_CONSTEXPR const bool is_modulo = false;
  148. static _LIBCPP_CONSTEXPR const bool traps = false;
  149. static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
  150. static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
  151. };
  152. template <class _Tp, int digits, bool is_signed>
  153. struct __libcpp_compute_min
  154. {
  155. static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << digits);
  156. };
  157. template <class _Tp, int digits>
  158. struct __libcpp_compute_min<_Tp, digits, false>
  159. {
  160. static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0);
  161. };
  162. template <class _Tp>
  163. class __libcpp_numeric_limits<_Tp, true>
  164. {
  165. protected:
  166. typedef _Tp type;
  167. static _LIBCPP_CONSTEXPR const bool is_specialized = true;
  168. static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0);
  169. static _LIBCPP_CONSTEXPR const int digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ - is_signed);
  170. static _LIBCPP_CONSTEXPR const int digits10 = digits * 3 / 10;
  171. static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
  172. static _LIBCPP_CONSTEXPR const type __min = __libcpp_compute_min<type, digits, is_signed>::value;
  173. static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
  174. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;}
  175. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;}
  176. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();}
  177. static _LIBCPP_CONSTEXPR const bool is_integer = true;
  178. static _LIBCPP_CONSTEXPR const bool is_exact = true;
  179. static _LIBCPP_CONSTEXPR const int radix = 2;
  180. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);}
  181. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);}
  182. static _LIBCPP_CONSTEXPR const int min_exponent = 0;
  183. static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
  184. static _LIBCPP_CONSTEXPR const int max_exponent = 0;
  185. static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
  186. static _LIBCPP_CONSTEXPR const bool has_infinity = false;
  187. static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
  188. static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
  189. static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
  190. static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
  191. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);}
  192. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);}
  193. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);}
  194. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);}
  195. static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
  196. static _LIBCPP_CONSTEXPR const bool is_bounded = true;
  197. static _LIBCPP_CONSTEXPR const bool is_modulo = !_VSTD::is_signed<_Tp>::value;
  198. #if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || \
  199. defined(__wasm__)
  200. static _LIBCPP_CONSTEXPR const bool traps = true;
  201. #else
  202. static _LIBCPP_CONSTEXPR const bool traps = false;
  203. #endif
  204. static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
  205. static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
  206. };
  207. template <>
  208. class __libcpp_numeric_limits<bool, true>
  209. {
  210. protected:
  211. typedef bool type;
  212. static _LIBCPP_CONSTEXPR const bool is_specialized = true;
  213. static _LIBCPP_CONSTEXPR const bool is_signed = false;
  214. static _LIBCPP_CONSTEXPR const int digits = 1;
  215. static _LIBCPP_CONSTEXPR const int digits10 = 0;
  216. static _LIBCPP_CONSTEXPR const int max_digits10 = 0;
  217. static _LIBCPP_CONSTEXPR const type __min = false;
  218. static _LIBCPP_CONSTEXPR const type __max = true;
  219. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __min;}
  220. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __max;}
  221. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return min();}
  222. static _LIBCPP_CONSTEXPR const bool is_integer = true;
  223. static _LIBCPP_CONSTEXPR const bool is_exact = true;
  224. static _LIBCPP_CONSTEXPR const int radix = 2;
  225. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);}
  226. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);}
  227. static _LIBCPP_CONSTEXPR const int min_exponent = 0;
  228. static _LIBCPP_CONSTEXPR const int min_exponent10 = 0;
  229. static _LIBCPP_CONSTEXPR const int max_exponent = 0;
  230. static _LIBCPP_CONSTEXPR const int max_exponent10 = 0;
  231. static _LIBCPP_CONSTEXPR const bool has_infinity = false;
  232. static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = false;
  233. static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = false;
  234. static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_absent;
  235. static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
  236. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);}
  237. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);}
  238. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);}
  239. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);}
  240. static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
  241. static _LIBCPP_CONSTEXPR const bool is_bounded = true;
  242. static _LIBCPP_CONSTEXPR const bool is_modulo = false;
  243. static _LIBCPP_CONSTEXPR const bool traps = false;
  244. static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
  245. static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
  246. };
  247. template <>
  248. class __libcpp_numeric_limits<float, true>
  249. {
  250. protected:
  251. typedef float type;
  252. static _LIBCPP_CONSTEXPR const bool is_specialized = true;
  253. static _LIBCPP_CONSTEXPR const bool is_signed = true;
  254. static _LIBCPP_CONSTEXPR const int digits = __FLT_MANT_DIG__;
  255. static _LIBCPP_CONSTEXPR const int digits10 = __FLT_DIG__;
  256. static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103)/100000;
  257. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __FLT_MIN__;}
  258. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __FLT_MAX__;}
  259. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
  260. static _LIBCPP_CONSTEXPR const bool is_integer = false;
  261. static _LIBCPP_CONSTEXPR const bool is_exact = false;
  262. static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
  263. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __FLT_EPSILON__;}
  264. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5F;}
  265. static _LIBCPP_CONSTEXPR const int min_exponent = __FLT_MIN_EXP__;
  266. static _LIBCPP_CONSTEXPR const int min_exponent10 = __FLT_MIN_10_EXP__;
  267. static _LIBCPP_CONSTEXPR const int max_exponent = __FLT_MAX_EXP__;
  268. static _LIBCPP_CONSTEXPR const int max_exponent10 = __FLT_MAX_10_EXP__;
  269. static _LIBCPP_CONSTEXPR const bool has_infinity = true;
  270. static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
  271. static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
  272. static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
  273. static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
  274. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_valf();}
  275. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanf("");}
  276. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansf("");}
  277. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;}
  278. static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
  279. static _LIBCPP_CONSTEXPR const bool is_bounded = true;
  280. static _LIBCPP_CONSTEXPR const bool is_modulo = false;
  281. static _LIBCPP_CONSTEXPR const bool traps = false;
  282. static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
  283. static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
  284. };
  285. template <>
  286. class __libcpp_numeric_limits<double, true>
  287. {
  288. protected:
  289. typedef double type;
  290. static _LIBCPP_CONSTEXPR const bool is_specialized = true;
  291. static _LIBCPP_CONSTEXPR const bool is_signed = true;
  292. static _LIBCPP_CONSTEXPR const int digits = __DBL_MANT_DIG__;
  293. static _LIBCPP_CONSTEXPR const int digits10 = __DBL_DIG__;
  294. static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103)/100000;
  295. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __DBL_MIN__;}
  296. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __DBL_MAX__;}
  297. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
  298. static _LIBCPP_CONSTEXPR const bool is_integer = false;
  299. static _LIBCPP_CONSTEXPR const bool is_exact = false;
  300. static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
  301. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __DBL_EPSILON__;}
  302. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
  303. static _LIBCPP_CONSTEXPR const int min_exponent = __DBL_MIN_EXP__;
  304. static _LIBCPP_CONSTEXPR const int min_exponent10 = __DBL_MIN_10_EXP__;
  305. static _LIBCPP_CONSTEXPR const int max_exponent = __DBL_MAX_EXP__;
  306. static _LIBCPP_CONSTEXPR const int max_exponent10 = __DBL_MAX_10_EXP__;
  307. static _LIBCPP_CONSTEXPR const bool has_infinity = true;
  308. static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
  309. static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
  310. static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
  311. static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
  312. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_val();}
  313. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nan("");}
  314. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nans("");}
  315. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;}
  316. static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
  317. static _LIBCPP_CONSTEXPR const bool is_bounded = true;
  318. static _LIBCPP_CONSTEXPR const bool is_modulo = false;
  319. static _LIBCPP_CONSTEXPR const bool traps = false;
  320. static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
  321. static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
  322. };
  323. template <>
  324. class __libcpp_numeric_limits<long double, true>
  325. {
  326. protected:
  327. typedef long double type;
  328. static _LIBCPP_CONSTEXPR const bool is_specialized = true;
  329. static _LIBCPP_CONSTEXPR const bool is_signed = true;
  330. static _LIBCPP_CONSTEXPR const int digits = __LDBL_MANT_DIG__;
  331. static _LIBCPP_CONSTEXPR const int digits10 = __LDBL_DIG__;
  332. static _LIBCPP_CONSTEXPR const int max_digits10 = 2+(digits * 30103)/100000;
  333. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __LDBL_MIN__;}
  334. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __LDBL_MAX__;}
  335. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return -max();}
  336. static _LIBCPP_CONSTEXPR const bool is_integer = false;
  337. static _LIBCPP_CONSTEXPR const bool is_exact = false;
  338. static _LIBCPP_CONSTEXPR const int radix = __FLT_RADIX__;
  339. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
  340. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return 0.5;}
  341. static _LIBCPP_CONSTEXPR const int min_exponent = __LDBL_MIN_EXP__;
  342. static _LIBCPP_CONSTEXPR const int min_exponent10 = __LDBL_MIN_10_EXP__;
  343. static _LIBCPP_CONSTEXPR const int max_exponent = __LDBL_MAX_EXP__;
  344. static _LIBCPP_CONSTEXPR const int max_exponent10 = __LDBL_MAX_10_EXP__;
  345. static _LIBCPP_CONSTEXPR const bool has_infinity = true;
  346. static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = true;
  347. static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = true;
  348. static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = denorm_present;
  349. static _LIBCPP_CONSTEXPR const bool has_denorm_loss = false;
  350. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __builtin_huge_vall();}
  351. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __builtin_nanl("");}
  352. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
  353. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
  354. #if (defined(__ppc__) || defined(__ppc64__))
  355. static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
  356. #else
  357. static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
  358. #endif
  359. static _LIBCPP_CONSTEXPR const bool is_bounded = true;
  360. static _LIBCPP_CONSTEXPR const bool is_modulo = false;
  361. static _LIBCPP_CONSTEXPR const bool traps = false;
  362. static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
  363. static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
  364. };
  365. template <class _Tp>
  366. class _LIBCPP_TYPE_VIS_ONLY numeric_limits
  367. : private __libcpp_numeric_limits<typename remove_cv<_Tp>::type>
  368. {
  369. typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base;
  370. typedef typename __base::type type;
  371. public:
  372. static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
  373. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
  374. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
  375. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
  376. static _LIBCPP_CONSTEXPR const int digits = __base::digits;
  377. static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
  378. static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
  379. static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
  380. static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
  381. static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
  382. static _LIBCPP_CONSTEXPR const int radix = __base::radix;
  383. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
  384. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
  385. static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
  386. static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
  387. static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
  388. static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
  389. static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
  390. static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
  391. static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
  392. static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
  393. static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
  394. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
  395. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
  396. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
  397. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
  398. static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
  399. static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
  400. static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
  401. static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
  402. static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
  403. static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
  404. };
  405. template <class _Tp>
  406. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_specialized;
  407. template <class _Tp>
  408. _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits;
  409. template <class _Tp>
  410. _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::digits10;
  411. template <class _Tp>
  412. _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_digits10;
  413. template <class _Tp>
  414. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_signed;
  415. template <class _Tp>
  416. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_integer;
  417. template <class _Tp>
  418. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_exact;
  419. template <class _Tp>
  420. _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::radix;
  421. template <class _Tp>
  422. _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent;
  423. template <class _Tp>
  424. _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::min_exponent10;
  425. template <class _Tp>
  426. _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent;
  427. template <class _Tp>
  428. _LIBCPP_CONSTEXPR const int numeric_limits<_Tp>::max_exponent10;
  429. template <class _Tp>
  430. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_infinity;
  431. template <class _Tp>
  432. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_quiet_NaN;
  433. template <class _Tp>
  434. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_signaling_NaN;
  435. template <class _Tp>
  436. _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<_Tp>::has_denorm;
  437. template <class _Tp>
  438. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::has_denorm_loss;
  439. template <class _Tp>
  440. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_iec559;
  441. template <class _Tp>
  442. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_bounded;
  443. template <class _Tp>
  444. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::is_modulo;
  445. template <class _Tp>
  446. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::traps;
  447. template <class _Tp>
  448. _LIBCPP_CONSTEXPR const bool numeric_limits<_Tp>::tinyness_before;
  449. template <class _Tp>
  450. _LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style;
  451. template <class _Tp>
  452. class _LIBCPP_TYPE_VIS_ONLY numeric_limits<const _Tp>
  453. : private numeric_limits<_Tp>
  454. {
  455. typedef numeric_limits<_Tp> __base;
  456. typedef _Tp type;
  457. public:
  458. static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
  459. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
  460. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
  461. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
  462. static _LIBCPP_CONSTEXPR const int digits = __base::digits;
  463. static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
  464. static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
  465. static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
  466. static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
  467. static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
  468. static _LIBCPP_CONSTEXPR const int radix = __base::radix;
  469. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
  470. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
  471. static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
  472. static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
  473. static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
  474. static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
  475. static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
  476. static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
  477. static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
  478. static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
  479. static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
  480. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
  481. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
  482. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
  483. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
  484. static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
  485. static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
  486. static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
  487. static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
  488. static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
  489. static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
  490. };
  491. template <class _Tp>
  492. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_specialized;
  493. template <class _Tp>
  494. _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits;
  495. template <class _Tp>
  496. _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::digits10;
  497. template <class _Tp>
  498. _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_digits10;
  499. template <class _Tp>
  500. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_signed;
  501. template <class _Tp>
  502. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_integer;
  503. template <class _Tp>
  504. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_exact;
  505. template <class _Tp>
  506. _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::radix;
  507. template <class _Tp>
  508. _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent;
  509. template <class _Tp>
  510. _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::min_exponent10;
  511. template <class _Tp>
  512. _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent;
  513. template <class _Tp>
  514. _LIBCPP_CONSTEXPR const int numeric_limits<const _Tp>::max_exponent10;
  515. template <class _Tp>
  516. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_infinity;
  517. template <class _Tp>
  518. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_quiet_NaN;
  519. template <class _Tp>
  520. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_signaling_NaN;
  521. template <class _Tp>
  522. _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const _Tp>::has_denorm;
  523. template <class _Tp>
  524. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::has_denorm_loss;
  525. template <class _Tp>
  526. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_iec559;
  527. template <class _Tp>
  528. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_bounded;
  529. template <class _Tp>
  530. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::is_modulo;
  531. template <class _Tp>
  532. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::traps;
  533. template <class _Tp>
  534. _LIBCPP_CONSTEXPR const bool numeric_limits<const _Tp>::tinyness_before;
  535. template <class _Tp>
  536. _LIBCPP_CONSTEXPR const float_round_style numeric_limits<const _Tp>::round_style;
  537. template <class _Tp>
  538. class _LIBCPP_TYPE_VIS_ONLY numeric_limits<volatile _Tp>
  539. : private numeric_limits<_Tp>
  540. {
  541. typedef numeric_limits<_Tp> __base;
  542. typedef _Tp type;
  543. public:
  544. static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
  545. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
  546. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
  547. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
  548. static _LIBCPP_CONSTEXPR const int digits = __base::digits;
  549. static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
  550. static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
  551. static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
  552. static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
  553. static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
  554. static _LIBCPP_CONSTEXPR const int radix = __base::radix;
  555. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
  556. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
  557. static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
  558. static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
  559. static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
  560. static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
  561. static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
  562. static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
  563. static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
  564. static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
  565. static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
  566. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
  567. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
  568. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
  569. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
  570. static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
  571. static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
  572. static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
  573. static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
  574. static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
  575. static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
  576. };
  577. template <class _Tp>
  578. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_specialized;
  579. template <class _Tp>
  580. _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits;
  581. template <class _Tp>
  582. _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::digits10;
  583. template <class _Tp>
  584. _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_digits10;
  585. template <class _Tp>
  586. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_signed;
  587. template <class _Tp>
  588. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_integer;
  589. template <class _Tp>
  590. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_exact;
  591. template <class _Tp>
  592. _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::radix;
  593. template <class _Tp>
  594. _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent;
  595. template <class _Tp>
  596. _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::min_exponent10;
  597. template <class _Tp>
  598. _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent;
  599. template <class _Tp>
  600. _LIBCPP_CONSTEXPR const int numeric_limits<volatile _Tp>::max_exponent10;
  601. template <class _Tp>
  602. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_infinity;
  603. template <class _Tp>
  604. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_quiet_NaN;
  605. template <class _Tp>
  606. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_signaling_NaN;
  607. template <class _Tp>
  608. _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<volatile _Tp>::has_denorm;
  609. template <class _Tp>
  610. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::has_denorm_loss;
  611. template <class _Tp>
  612. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_iec559;
  613. template <class _Tp>
  614. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_bounded;
  615. template <class _Tp>
  616. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::is_modulo;
  617. template <class _Tp>
  618. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::traps;
  619. template <class _Tp>
  620. _LIBCPP_CONSTEXPR const bool numeric_limits<volatile _Tp>::tinyness_before;
  621. template <class _Tp>
  622. _LIBCPP_CONSTEXPR const float_round_style numeric_limits<volatile _Tp>::round_style;
  623. template <class _Tp>
  624. class _LIBCPP_TYPE_VIS_ONLY numeric_limits<const volatile _Tp>
  625. : private numeric_limits<_Tp>
  626. {
  627. typedef numeric_limits<_Tp> __base;
  628. typedef _Tp type;
  629. public:
  630. static _LIBCPP_CONSTEXPR const bool is_specialized = __base::is_specialized;
  631. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return __base::min();}
  632. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return __base::max();}
  633. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return __base::lowest();}
  634. static _LIBCPP_CONSTEXPR const int digits = __base::digits;
  635. static _LIBCPP_CONSTEXPR const int digits10 = __base::digits10;
  636. static _LIBCPP_CONSTEXPR const int max_digits10 = __base::max_digits10;
  637. static _LIBCPP_CONSTEXPR const bool is_signed = __base::is_signed;
  638. static _LIBCPP_CONSTEXPR const bool is_integer = __base::is_integer;
  639. static _LIBCPP_CONSTEXPR const bool is_exact = __base::is_exact;
  640. static _LIBCPP_CONSTEXPR const int radix = __base::radix;
  641. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return __base::epsilon();}
  642. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return __base::round_error();}
  643. static _LIBCPP_CONSTEXPR const int min_exponent = __base::min_exponent;
  644. static _LIBCPP_CONSTEXPR const int min_exponent10 = __base::min_exponent10;
  645. static _LIBCPP_CONSTEXPR const int max_exponent = __base::max_exponent;
  646. static _LIBCPP_CONSTEXPR const int max_exponent10 = __base::max_exponent10;
  647. static _LIBCPP_CONSTEXPR const bool has_infinity = __base::has_infinity;
  648. static _LIBCPP_CONSTEXPR const bool has_quiet_NaN = __base::has_quiet_NaN;
  649. static _LIBCPP_CONSTEXPR const bool has_signaling_NaN = __base::has_signaling_NaN;
  650. static _LIBCPP_CONSTEXPR const float_denorm_style has_denorm = __base::has_denorm;
  651. static _LIBCPP_CONSTEXPR const bool has_denorm_loss = __base::has_denorm_loss;
  652. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return __base::infinity();}
  653. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
  654. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
  655. _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __base::denorm_min();}
  656. static _LIBCPP_CONSTEXPR const bool is_iec559 = __base::is_iec559;
  657. static _LIBCPP_CONSTEXPR const bool is_bounded = __base::is_bounded;
  658. static _LIBCPP_CONSTEXPR const bool is_modulo = __base::is_modulo;
  659. static _LIBCPP_CONSTEXPR const bool traps = __base::traps;
  660. static _LIBCPP_CONSTEXPR const bool tinyness_before = __base::tinyness_before;
  661. static _LIBCPP_CONSTEXPR const float_round_style round_style = __base::round_style;
  662. };
  663. template <class _Tp>
  664. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_specialized;
  665. template <class _Tp>
  666. _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits;
  667. template <class _Tp>
  668. _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::digits10;
  669. template <class _Tp>
  670. _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_digits10;
  671. template <class _Tp>
  672. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_signed;
  673. template <class _Tp>
  674. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_integer;
  675. template <class _Tp>
  676. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_exact;
  677. template <class _Tp>
  678. _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::radix;
  679. template <class _Tp>
  680. _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent;
  681. template <class _Tp>
  682. _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::min_exponent10;
  683. template <class _Tp>
  684. _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent;
  685. template <class _Tp>
  686. _LIBCPP_CONSTEXPR const int numeric_limits<const volatile _Tp>::max_exponent10;
  687. template <class _Tp>
  688. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_infinity;
  689. template <class _Tp>
  690. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_quiet_NaN;
  691. template <class _Tp>
  692. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_signaling_NaN;
  693. template <class _Tp>
  694. _LIBCPP_CONSTEXPR const float_denorm_style numeric_limits<const volatile _Tp>::has_denorm;
  695. template <class _Tp>
  696. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::has_denorm_loss;
  697. template <class _Tp>
  698. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_iec559;
  699. template <class _Tp>
  700. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_bounded;
  701. template <class _Tp>
  702. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::is_modulo;
  703. template <class _Tp>
  704. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::traps;
  705. template <class _Tp>
  706. _LIBCPP_CONSTEXPR const bool numeric_limits<const volatile _Tp>::tinyness_before;
  707. template <class _Tp>
  708. _LIBCPP_CONSTEXPR const float_round_style numeric_limits<const volatile _Tp>::round_style;
  709. _LIBCPP_END_NAMESPACE_STD
  710. #endif // _LIBCPP_LIMITS