limits 40 KB

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