limits 40 KB

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