limits 40 KB

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