limits 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827
  1. // The template and inlines for the numeric_limits classes. -*- C++ -*-
  2. // Copyright (C) 1999-2018 Free Software Foundation, Inc.
  3. //
  4. // This file is part of the GNU ISO C++ Library. This library is free
  5. // software; you can redistribute it and/or modify it under the
  6. // terms of the GNU General Public License as published by the
  7. // Free Software Foundation; either version 3, or (at your option)
  8. // any later version.
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. // Under Section 7 of GPL version 3, you are granted additional
  14. // permissions described in the GCC Runtime Library Exception, version
  15. // 3.1, as published by the Free Software Foundation.
  16. // You should have received a copy of the GNU General Public License and
  17. // a copy of the GCC Runtime Library Exception along with this program;
  18. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. // <http://www.gnu.org/licenses/>.
  20. /** @file include/limits
  21. * This is a Standard C++ Library header.
  22. */
  23. // Note: this is not a conforming implementation.
  24. // Written by Gabriel Dos Reis <gdr@codesourcery.com>
  25. //
  26. // ISO 14882:1998
  27. // 18.2.1
  28. //
  29. #ifndef _GLIBCXX_NUMERIC_LIMITS
  30. #define _GLIBCXX_NUMERIC_LIMITS 1
  31. #pragma GCC system_header
  32. #include <bits/c++config.h>
  33. //
  34. // The numeric_limits<> traits document implementation-defined aspects
  35. // of fundamental arithmetic data types (integers and floating points).
  36. // From Standard C++ point of view, there are 14 such types:
  37. // * integers
  38. // bool (1)
  39. // char, signed char, unsigned char, wchar_t (4)
  40. // short, unsigned short (2)
  41. // int, unsigned (2)
  42. // long, unsigned long (2)
  43. //
  44. // * floating points
  45. // float (1)
  46. // double (1)
  47. // long double (1)
  48. //
  49. // GNU C++ understands (where supported by the host C-library)
  50. // * integer
  51. // long long, unsigned long long (2)
  52. //
  53. // which brings us to 16 fundamental arithmetic data types in GNU C++.
  54. //
  55. //
  56. // Since a numeric_limits<> is a bit tricky to get right, we rely on
  57. // an interface composed of macros which should be defined in config/os
  58. // or config/cpu when they differ from the generic (read arbitrary)
  59. // definitions given here.
  60. //
  61. // These values can be overridden in the target configuration file.
  62. // The default values are appropriate for many 32-bit targets.
  63. // GCC only intrinsically supports modulo integral types. The only remaining
  64. // integral exceptional values is division by zero. Only targets that do not
  65. // signal division by zero in some "hard to ignore" way should use false.
  66. #ifndef __glibcxx_integral_traps
  67. # define __glibcxx_integral_traps true
  68. #endif
  69. // float
  70. //
  71. // Default values. Should be overridden in configuration files if necessary.
  72. #ifndef __glibcxx_float_has_denorm_loss
  73. # define __glibcxx_float_has_denorm_loss false
  74. #endif
  75. #ifndef __glibcxx_float_traps
  76. # define __glibcxx_float_traps false
  77. #endif
  78. #ifndef __glibcxx_float_tinyness_before
  79. # define __glibcxx_float_tinyness_before false
  80. #endif
  81. // double
  82. // Default values. Should be overridden in configuration files if necessary.
  83. #ifndef __glibcxx_double_has_denorm_loss
  84. # define __glibcxx_double_has_denorm_loss false
  85. #endif
  86. #ifndef __glibcxx_double_traps
  87. # define __glibcxx_double_traps false
  88. #endif
  89. #ifndef __glibcxx_double_tinyness_before
  90. # define __glibcxx_double_tinyness_before false
  91. #endif
  92. // long double
  93. // Default values. Should be overridden in configuration files if necessary.
  94. #ifndef __glibcxx_long_double_has_denorm_loss
  95. # define __glibcxx_long_double_has_denorm_loss false
  96. #endif
  97. #ifndef __glibcxx_long_double_traps
  98. # define __glibcxx_long_double_traps false
  99. #endif
  100. #ifndef __glibcxx_long_double_tinyness_before
  101. # define __glibcxx_long_double_tinyness_before false
  102. #endif
  103. // You should not need to define any macros below this point.
  104. #define __glibcxx_signed_b(T,B) ((T)(-1) < 0)
  105. #define __glibcxx_min_b(T,B) \
  106. (__glibcxx_signed_b (T,B) ? -__glibcxx_max_b (T,B) - 1 : (T)0)
  107. #define __glibcxx_max_b(T,B) \
  108. (__glibcxx_signed_b (T,B) ? \
  109. (((((T)1 << (__glibcxx_digits_b (T,B) - 1)) - 1) << 1) + 1) : ~(T)0)
  110. #define __glibcxx_digits_b(T,B) \
  111. (B - __glibcxx_signed_b (T,B))
  112. // The fraction 643/2136 approximates log10(2) to 7 significant digits.
  113. #define __glibcxx_digits10_b(T,B) \
  114. (__glibcxx_digits_b (T,B) * 643L / 2136)
  115. #define __glibcxx_signed(T) \
  116. __glibcxx_signed_b (T, sizeof(T) * __CHAR_BIT__)
  117. #define __glibcxx_min(T) \
  118. __glibcxx_min_b (T, sizeof(T) * __CHAR_BIT__)
  119. #define __glibcxx_max(T) \
  120. __glibcxx_max_b (T, sizeof(T) * __CHAR_BIT__)
  121. #define __glibcxx_digits(T) \
  122. __glibcxx_digits_b (T, sizeof(T) * __CHAR_BIT__)
  123. #define __glibcxx_digits10(T) \
  124. __glibcxx_digits10_b (T, sizeof(T) * __CHAR_BIT__)
  125. #define __glibcxx_max_digits10(T) \
  126. (2 + (T) * 643L / 2136)
  127. namespace std _GLIBCXX_VISIBILITY(default)
  128. {
  129. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  130. /**
  131. * @brief Describes the rounding style for floating-point types.
  132. *
  133. * This is used in the std::numeric_limits class.
  134. */
  135. enum float_round_style
  136. {
  137. round_indeterminate = -1, /// Intermediate.
  138. round_toward_zero = 0, /// To zero.
  139. round_to_nearest = 1, /// To the nearest representable value.
  140. round_toward_infinity = 2, /// To infinity.
  141. round_toward_neg_infinity = 3 /// To negative infinity.
  142. };
  143. /**
  144. * @brief Describes the denormalization for floating-point types.
  145. *
  146. * These values represent the presence or absence of a variable number
  147. * of exponent bits. This type is used in the std::numeric_limits class.
  148. */
  149. enum float_denorm_style
  150. {
  151. /// Indeterminate at compile time whether denormalized values are allowed.
  152. denorm_indeterminate = -1,
  153. /// The type does not allow denormalized values.
  154. denorm_absent = 0,
  155. /// The type allows denormalized values.
  156. denorm_present = 1
  157. };
  158. /**
  159. * @brief Part of std::numeric_limits.
  160. *
  161. * The @c static @c const members are usable as integral constant
  162. * expressions.
  163. *
  164. * @note This is a separate class for purposes of efficiency; you
  165. * should only access these members as part of an instantiation
  166. * of the std::numeric_limits class.
  167. */
  168. struct __numeric_limits_base
  169. {
  170. /** This will be true for all fundamental types (which have
  171. specializations), and false for everything else. */
  172. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = false;
  173. /** The number of @c radix digits that be represented without change: for
  174. integer types, the number of non-sign bits in the mantissa; for
  175. floating types, the number of @c radix digits in the mantissa. */
  176. static _GLIBCXX_USE_CONSTEXPR int digits = 0;
  177. /** The number of base 10 digits that can be represented without change. */
  178. static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
  179. #if __cplusplus >= 201103L
  180. /** The number of base 10 digits required to ensure that values which
  181. differ are always differentiated. */
  182. static constexpr int max_digits10 = 0;
  183. #endif
  184. /** True if the type is signed. */
  185. static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
  186. /** True if the type is integer. */
  187. static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
  188. /** True if the type uses an exact representation. All integer types are
  189. exact, but not all exact types are integer. For example, rational and
  190. fixed-exponent representations are exact but not integer. */
  191. static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
  192. /** For integer types, specifies the base of the representation. For
  193. floating types, specifies the base of the exponent representation. */
  194. static _GLIBCXX_USE_CONSTEXPR int radix = 0;
  195. /** The minimum negative integer such that @c radix raised to the power of
  196. (one less than that integer) is a normalized floating point number. */
  197. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  198. /** The minimum negative integer such that 10 raised to that power is in
  199. the range of normalized floating point numbers. */
  200. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  201. /** The maximum positive integer such that @c radix raised to the power of
  202. (one less than that integer) is a representable finite floating point
  203. number. */
  204. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  205. /** The maximum positive integer such that 10 raised to that power is in
  206. the range of representable finite floating point numbers. */
  207. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  208. /** True if the type has a representation for positive infinity. */
  209. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  210. /** True if the type has a representation for a quiet (non-signaling)
  211. Not a Number. */
  212. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  213. /** True if the type has a representation for a signaling
  214. Not a Number. */
  215. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  216. /** See std::float_denorm_style for more information. */
  217. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent;
  218. /** True if loss of accuracy is detected as a denormalization loss,
  219. rather than as an inexact result. */
  220. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  221. /** True if-and-only-if the type adheres to the IEC 559 standard, also
  222. known as IEEE 754. (Only makes sense for floating point types.) */
  223. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  224. /** True if the set of values representable by the type is
  225. finite. All built-in types are bounded, this member would be
  226. false for arbitrary precision types. */
  227. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = false;
  228. /** True if the type is @e modulo. A type is modulo if, for any
  229. operation involving +, -, or * on values of that type whose
  230. result would fall outside the range [min(),max()], the value
  231. returned differs from the true value by an integer multiple of
  232. max() - min() + 1. On most machines, this is false for floating
  233. types, true for unsigned integers, and true for signed integers.
  234. See PR22200 about signed integers. */
  235. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
  236. /** True if trapping is implemented for this type. */
  237. static _GLIBCXX_USE_CONSTEXPR bool traps = false;
  238. /** True if tininess is detected before rounding. (see IEC 559) */
  239. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  240. /** See std::float_round_style for more information. This is only
  241. meaningful for floating types; integer types will all be
  242. round_toward_zero. */
  243. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style =
  244. round_toward_zero;
  245. };
  246. /**
  247. * @brief Properties of fundamental types.
  248. *
  249. * This class allows a program to obtain information about the
  250. * representation of a fundamental type on a given platform. For
  251. * non-fundamental types, the functions will return 0 and the data
  252. * members will all be @c false.
  253. */
  254. template<typename _Tp>
  255. struct numeric_limits : public __numeric_limits_base
  256. {
  257. /** The minimum finite value, or for floating types with
  258. denormalization, the minimum positive normalized value. */
  259. static _GLIBCXX_CONSTEXPR _Tp
  260. min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
  261. /** The maximum finite value. */
  262. static _GLIBCXX_CONSTEXPR _Tp
  263. max() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
  264. #if __cplusplus >= 201103L
  265. /** A finite value x such that there is no other finite value y
  266. * where y < x. */
  267. static constexpr _Tp
  268. lowest() noexcept { return _Tp(); }
  269. #endif
  270. /** The @e machine @e epsilon: the difference between 1 and the least
  271. value greater than 1 that is representable. */
  272. static _GLIBCXX_CONSTEXPR _Tp
  273. epsilon() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
  274. /** The maximum rounding error measurement (see LIA-1). */
  275. static _GLIBCXX_CONSTEXPR _Tp
  276. round_error() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
  277. /** The representation of positive infinity, if @c has_infinity. */
  278. static _GLIBCXX_CONSTEXPR _Tp
  279. infinity() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
  280. /** The representation of a quiet Not a Number,
  281. if @c has_quiet_NaN. */
  282. static _GLIBCXX_CONSTEXPR _Tp
  283. quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
  284. /** The representation of a signaling Not a Number, if
  285. @c has_signaling_NaN. */
  286. static _GLIBCXX_CONSTEXPR _Tp
  287. signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
  288. /** The minimum positive denormalized value. For types where
  289. @c has_denorm is false, this is the minimum positive normalized
  290. value. */
  291. static _GLIBCXX_CONSTEXPR _Tp
  292. denorm_min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
  293. };
  294. // _GLIBCXX_RESOLVE_LIB_DEFECTS
  295. // 559. numeric_limits<const T>
  296. template<typename _Tp>
  297. struct numeric_limits<const _Tp>
  298. : public numeric_limits<_Tp> { };
  299. template<typename _Tp>
  300. struct numeric_limits<volatile _Tp>
  301. : public numeric_limits<_Tp> { };
  302. template<typename _Tp>
  303. struct numeric_limits<const volatile _Tp>
  304. : public numeric_limits<_Tp> { };
  305. // Now there follow 16 explicit specializations. Yes, 16. Make sure
  306. // you get the count right. (18 in C++11 mode, with char16_t and char32_t.)
  307. // _GLIBCXX_RESOLVE_LIB_DEFECTS
  308. // 184. numeric_limits<bool> wording problems
  309. /// numeric_limits<bool> specialization.
  310. template<>
  311. struct numeric_limits<bool>
  312. {
  313. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  314. static _GLIBCXX_CONSTEXPR bool
  315. min() _GLIBCXX_USE_NOEXCEPT { return false; }
  316. static _GLIBCXX_CONSTEXPR bool
  317. max() _GLIBCXX_USE_NOEXCEPT { return true; }
  318. #if __cplusplus >= 201103L
  319. static constexpr bool
  320. lowest() noexcept { return min(); }
  321. #endif
  322. static _GLIBCXX_USE_CONSTEXPR int digits = 1;
  323. static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
  324. #if __cplusplus >= 201103L
  325. static constexpr int max_digits10 = 0;
  326. #endif
  327. static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
  328. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  329. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  330. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  331. static _GLIBCXX_CONSTEXPR bool
  332. epsilon() _GLIBCXX_USE_NOEXCEPT { return false; }
  333. static _GLIBCXX_CONSTEXPR bool
  334. round_error() _GLIBCXX_USE_NOEXCEPT { return false; }
  335. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  336. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  337. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  338. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  339. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  340. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  341. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  342. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  343. = denorm_absent;
  344. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  345. static _GLIBCXX_CONSTEXPR bool
  346. infinity() _GLIBCXX_USE_NOEXCEPT { return false; }
  347. static _GLIBCXX_CONSTEXPR bool
  348. quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return false; }
  349. static _GLIBCXX_CONSTEXPR bool
  350. signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return false; }
  351. static _GLIBCXX_CONSTEXPR bool
  352. denorm_min() _GLIBCXX_USE_NOEXCEPT { return false; }
  353. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  354. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  355. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
  356. // It is not clear what it means for a boolean type to trap.
  357. // This is a DR on the LWG issue list. Here, I use integer
  358. // promotion semantics.
  359. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  360. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  361. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  362. = round_toward_zero;
  363. };
  364. /// numeric_limits<char> specialization.
  365. template<>
  366. struct numeric_limits<char>
  367. {
  368. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  369. static _GLIBCXX_CONSTEXPR char
  370. min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min(char); }
  371. static _GLIBCXX_CONSTEXPR char
  372. max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max(char); }
  373. #if __cplusplus >= 201103L
  374. static constexpr char
  375. lowest() noexcept { return min(); }
  376. #endif
  377. static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char);
  378. static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char);
  379. #if __cplusplus >= 201103L
  380. static constexpr int max_digits10 = 0;
  381. #endif
  382. static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char);
  383. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  384. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  385. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  386. static _GLIBCXX_CONSTEXPR char
  387. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
  388. static _GLIBCXX_CONSTEXPR char
  389. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
  390. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  391. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  392. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  393. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  394. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  395. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  396. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  397. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  398. = denorm_absent;
  399. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  400. static _GLIBCXX_CONSTEXPR
  401. char infinity() _GLIBCXX_USE_NOEXCEPT { return char(); }
  402. static _GLIBCXX_CONSTEXPR char
  403. quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); }
  404. static _GLIBCXX_CONSTEXPR char
  405. signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); }
  406. static _GLIBCXX_CONSTEXPR char
  407. denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<char>(0); }
  408. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  409. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  410. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed;
  411. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  412. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  413. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  414. = round_toward_zero;
  415. };
  416. /// numeric_limits<signed char> specialization.
  417. template<>
  418. struct numeric_limits<signed char>
  419. {
  420. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  421. static _GLIBCXX_CONSTEXPR signed char
  422. min() _GLIBCXX_USE_NOEXCEPT { return -__SCHAR_MAX__ - 1; }
  423. static _GLIBCXX_CONSTEXPR signed char
  424. max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__; }
  425. #if __cplusplus >= 201103L
  426. static constexpr signed char
  427. lowest() noexcept { return min(); }
  428. #endif
  429. static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char);
  430. static _GLIBCXX_USE_CONSTEXPR int digits10
  431. = __glibcxx_digits10 (signed char);
  432. #if __cplusplus >= 201103L
  433. static constexpr int max_digits10 = 0;
  434. #endif
  435. static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
  436. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  437. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  438. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  439. static _GLIBCXX_CONSTEXPR signed char
  440. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
  441. static _GLIBCXX_CONSTEXPR signed char
  442. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
  443. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  444. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  445. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  446. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  447. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  448. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  449. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  450. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  451. = denorm_absent;
  452. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  453. static _GLIBCXX_CONSTEXPR signed char
  454. infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); }
  455. static _GLIBCXX_CONSTEXPR signed char
  456. quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); }
  457. static _GLIBCXX_CONSTEXPR signed char
  458. signaling_NaN() _GLIBCXX_USE_NOEXCEPT
  459. { return static_cast<signed char>(0); }
  460. static _GLIBCXX_CONSTEXPR signed char
  461. denorm_min() _GLIBCXX_USE_NOEXCEPT
  462. { return static_cast<signed char>(0); }
  463. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  464. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  465. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
  466. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  467. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  468. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  469. = round_toward_zero;
  470. };
  471. /// numeric_limits<unsigned char> specialization.
  472. template<>
  473. struct numeric_limits<unsigned char>
  474. {
  475. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  476. static _GLIBCXX_CONSTEXPR unsigned char
  477. min() _GLIBCXX_USE_NOEXCEPT { return 0; }
  478. static _GLIBCXX_CONSTEXPR unsigned char
  479. max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__ * 2U + 1; }
  480. #if __cplusplus >= 201103L
  481. static constexpr unsigned char
  482. lowest() noexcept { return min(); }
  483. #endif
  484. static _GLIBCXX_USE_CONSTEXPR int digits
  485. = __glibcxx_digits (unsigned char);
  486. static _GLIBCXX_USE_CONSTEXPR int digits10
  487. = __glibcxx_digits10 (unsigned char);
  488. #if __cplusplus >= 201103L
  489. static constexpr int max_digits10 = 0;
  490. #endif
  491. static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
  492. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  493. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  494. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  495. static _GLIBCXX_CONSTEXPR unsigned char
  496. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
  497. static _GLIBCXX_CONSTEXPR unsigned char
  498. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
  499. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  500. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  501. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  502. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  503. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  504. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  505. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  506. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  507. = denorm_absent;
  508. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  509. static _GLIBCXX_CONSTEXPR unsigned char
  510. infinity() _GLIBCXX_USE_NOEXCEPT
  511. { return static_cast<unsigned char>(0); }
  512. static _GLIBCXX_CONSTEXPR unsigned char
  513. quiet_NaN() _GLIBCXX_USE_NOEXCEPT
  514. { return static_cast<unsigned char>(0); }
  515. static _GLIBCXX_CONSTEXPR unsigned char
  516. signaling_NaN() _GLIBCXX_USE_NOEXCEPT
  517. { return static_cast<unsigned char>(0); }
  518. static _GLIBCXX_CONSTEXPR unsigned char
  519. denorm_min() _GLIBCXX_USE_NOEXCEPT
  520. { return static_cast<unsigned char>(0); }
  521. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  522. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  523. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
  524. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  525. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  526. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  527. = round_toward_zero;
  528. };
  529. /// numeric_limits<wchar_t> specialization.
  530. template<>
  531. struct numeric_limits<wchar_t>
  532. {
  533. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  534. static _GLIBCXX_CONSTEXPR wchar_t
  535. min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (wchar_t); }
  536. static _GLIBCXX_CONSTEXPR wchar_t
  537. max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (wchar_t); }
  538. #if __cplusplus >= 201103L
  539. static constexpr wchar_t
  540. lowest() noexcept { return min(); }
  541. #endif
  542. static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t);
  543. static _GLIBCXX_USE_CONSTEXPR int digits10
  544. = __glibcxx_digits10 (wchar_t);
  545. #if __cplusplus >= 201103L
  546. static constexpr int max_digits10 = 0;
  547. #endif
  548. static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (wchar_t);
  549. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  550. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  551. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  552. static _GLIBCXX_CONSTEXPR wchar_t
  553. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
  554. static _GLIBCXX_CONSTEXPR wchar_t
  555. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
  556. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  557. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  558. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  559. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  560. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  561. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  562. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  563. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  564. = denorm_absent;
  565. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  566. static _GLIBCXX_CONSTEXPR wchar_t
  567. infinity() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); }
  568. static _GLIBCXX_CONSTEXPR wchar_t
  569. quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); }
  570. static _GLIBCXX_CONSTEXPR wchar_t
  571. signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); }
  572. static _GLIBCXX_CONSTEXPR wchar_t
  573. denorm_min() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); }
  574. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  575. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  576. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed;
  577. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  578. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  579. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  580. = round_toward_zero;
  581. };
  582. #if __cplusplus >= 201103L
  583. /// numeric_limits<char16_t> specialization.
  584. template<>
  585. struct numeric_limits<char16_t>
  586. {
  587. static constexpr bool is_specialized = true;
  588. static constexpr char16_t
  589. min() noexcept { return __glibcxx_min (char16_t); }
  590. static constexpr char16_t
  591. max() noexcept { return __glibcxx_max (char16_t); }
  592. static constexpr char16_t
  593. lowest() noexcept { return min(); }
  594. static constexpr int digits = __glibcxx_digits (char16_t);
  595. static constexpr int digits10 = __glibcxx_digits10 (char16_t);
  596. static constexpr int max_digits10 = 0;
  597. static constexpr bool is_signed = __glibcxx_signed (char16_t);
  598. static constexpr bool is_integer = true;
  599. static constexpr bool is_exact = true;
  600. static constexpr int radix = 2;
  601. static constexpr char16_t
  602. epsilon() noexcept { return 0; }
  603. static constexpr char16_t
  604. round_error() noexcept { return 0; }
  605. static constexpr int min_exponent = 0;
  606. static constexpr int min_exponent10 = 0;
  607. static constexpr int max_exponent = 0;
  608. static constexpr int max_exponent10 = 0;
  609. static constexpr bool has_infinity = false;
  610. static constexpr bool has_quiet_NaN = false;
  611. static constexpr bool has_signaling_NaN = false;
  612. static constexpr float_denorm_style has_denorm = denorm_absent;
  613. static constexpr bool has_denorm_loss = false;
  614. static constexpr char16_t
  615. infinity() noexcept { return char16_t(); }
  616. static constexpr char16_t
  617. quiet_NaN() noexcept { return char16_t(); }
  618. static constexpr char16_t
  619. signaling_NaN() noexcept { return char16_t(); }
  620. static constexpr char16_t
  621. denorm_min() noexcept { return char16_t(); }
  622. static constexpr bool is_iec559 = false;
  623. static constexpr bool is_bounded = true;
  624. static constexpr bool is_modulo = !is_signed;
  625. static constexpr bool traps = __glibcxx_integral_traps;
  626. static constexpr bool tinyness_before = false;
  627. static constexpr float_round_style round_style = round_toward_zero;
  628. };
  629. /// numeric_limits<char32_t> specialization.
  630. template<>
  631. struct numeric_limits<char32_t>
  632. {
  633. static constexpr bool is_specialized = true;
  634. static constexpr char32_t
  635. min() noexcept { return __glibcxx_min (char32_t); }
  636. static constexpr char32_t
  637. max() noexcept { return __glibcxx_max (char32_t); }
  638. static constexpr char32_t
  639. lowest() noexcept { return min(); }
  640. static constexpr int digits = __glibcxx_digits (char32_t);
  641. static constexpr int digits10 = __glibcxx_digits10 (char32_t);
  642. static constexpr int max_digits10 = 0;
  643. static constexpr bool is_signed = __glibcxx_signed (char32_t);
  644. static constexpr bool is_integer = true;
  645. static constexpr bool is_exact = true;
  646. static constexpr int radix = 2;
  647. static constexpr char32_t
  648. epsilon() noexcept { return 0; }
  649. static constexpr char32_t
  650. round_error() noexcept { return 0; }
  651. static constexpr int min_exponent = 0;
  652. static constexpr int min_exponent10 = 0;
  653. static constexpr int max_exponent = 0;
  654. static constexpr int max_exponent10 = 0;
  655. static constexpr bool has_infinity = false;
  656. static constexpr bool has_quiet_NaN = false;
  657. static constexpr bool has_signaling_NaN = false;
  658. static constexpr float_denorm_style has_denorm = denorm_absent;
  659. static constexpr bool has_denorm_loss = false;
  660. static constexpr char32_t
  661. infinity() noexcept { return char32_t(); }
  662. static constexpr char32_t
  663. quiet_NaN() noexcept { return char32_t(); }
  664. static constexpr char32_t
  665. signaling_NaN() noexcept { return char32_t(); }
  666. static constexpr char32_t
  667. denorm_min() noexcept { return char32_t(); }
  668. static constexpr bool is_iec559 = false;
  669. static constexpr bool is_bounded = true;
  670. static constexpr bool is_modulo = !is_signed;
  671. static constexpr bool traps = __glibcxx_integral_traps;
  672. static constexpr bool tinyness_before = false;
  673. static constexpr float_round_style round_style = round_toward_zero;
  674. };
  675. #endif
  676. /// numeric_limits<short> specialization.
  677. template<>
  678. struct numeric_limits<short>
  679. {
  680. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  681. static _GLIBCXX_CONSTEXPR short
  682. min() _GLIBCXX_USE_NOEXCEPT { return -__SHRT_MAX__ - 1; }
  683. static _GLIBCXX_CONSTEXPR short
  684. max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__; }
  685. #if __cplusplus >= 201103L
  686. static constexpr short
  687. lowest() noexcept { return min(); }
  688. #endif
  689. static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short);
  690. static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short);
  691. #if __cplusplus >= 201103L
  692. static constexpr int max_digits10 = 0;
  693. #endif
  694. static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
  695. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  696. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  697. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  698. static _GLIBCXX_CONSTEXPR short
  699. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
  700. static _GLIBCXX_CONSTEXPR short
  701. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
  702. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  703. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  704. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  705. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  706. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  707. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  708. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  709. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  710. = denorm_absent;
  711. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  712. static _GLIBCXX_CONSTEXPR short
  713. infinity() _GLIBCXX_USE_NOEXCEPT { return short(); }
  714. static _GLIBCXX_CONSTEXPR short
  715. quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); }
  716. static _GLIBCXX_CONSTEXPR short
  717. signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); }
  718. static _GLIBCXX_CONSTEXPR short
  719. denorm_min() _GLIBCXX_USE_NOEXCEPT { return short(); }
  720. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  721. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  722. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
  723. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  724. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  725. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  726. = round_toward_zero;
  727. };
  728. /// numeric_limits<unsigned short> specialization.
  729. template<>
  730. struct numeric_limits<unsigned short>
  731. {
  732. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  733. static _GLIBCXX_CONSTEXPR unsigned short
  734. min() _GLIBCXX_USE_NOEXCEPT { return 0; }
  735. static _GLIBCXX_CONSTEXPR unsigned short
  736. max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__ * 2U + 1; }
  737. #if __cplusplus >= 201103L
  738. static constexpr unsigned short
  739. lowest() noexcept { return min(); }
  740. #endif
  741. static _GLIBCXX_USE_CONSTEXPR int digits
  742. = __glibcxx_digits (unsigned short);
  743. static _GLIBCXX_USE_CONSTEXPR int digits10
  744. = __glibcxx_digits10 (unsigned short);
  745. #if __cplusplus >= 201103L
  746. static constexpr int max_digits10 = 0;
  747. #endif
  748. static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
  749. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  750. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  751. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  752. static _GLIBCXX_CONSTEXPR unsigned short
  753. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
  754. static _GLIBCXX_CONSTEXPR unsigned short
  755. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
  756. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  757. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  758. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  759. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  760. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  761. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  762. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  763. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  764. = denorm_absent;
  765. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  766. static _GLIBCXX_CONSTEXPR unsigned short
  767. infinity() _GLIBCXX_USE_NOEXCEPT
  768. { return static_cast<unsigned short>(0); }
  769. static _GLIBCXX_CONSTEXPR unsigned short
  770. quiet_NaN() _GLIBCXX_USE_NOEXCEPT
  771. { return static_cast<unsigned short>(0); }
  772. static _GLIBCXX_CONSTEXPR unsigned short
  773. signaling_NaN() _GLIBCXX_USE_NOEXCEPT
  774. { return static_cast<unsigned short>(0); }
  775. static _GLIBCXX_CONSTEXPR unsigned short
  776. denorm_min() _GLIBCXX_USE_NOEXCEPT
  777. { return static_cast<unsigned short>(0); }
  778. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  779. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  780. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
  781. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  782. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  783. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  784. = round_toward_zero;
  785. };
  786. /// numeric_limits<int> specialization.
  787. template<>
  788. struct numeric_limits<int>
  789. {
  790. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  791. static _GLIBCXX_CONSTEXPR int
  792. min() _GLIBCXX_USE_NOEXCEPT { return -__INT_MAX__ - 1; }
  793. static _GLIBCXX_CONSTEXPR int
  794. max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__; }
  795. #if __cplusplus >= 201103L
  796. static constexpr int
  797. lowest() noexcept { return min(); }
  798. #endif
  799. static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int);
  800. static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int);
  801. #if __cplusplus >= 201103L
  802. static constexpr int max_digits10 = 0;
  803. #endif
  804. static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
  805. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  806. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  807. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  808. static _GLIBCXX_CONSTEXPR int
  809. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
  810. static _GLIBCXX_CONSTEXPR int
  811. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
  812. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  813. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  814. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  815. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  816. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  817. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  818. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  819. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  820. = denorm_absent;
  821. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  822. static _GLIBCXX_CONSTEXPR int
  823. infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); }
  824. static _GLIBCXX_CONSTEXPR int
  825. quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); }
  826. static _GLIBCXX_CONSTEXPR int
  827. signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); }
  828. static _GLIBCXX_CONSTEXPR int
  829. denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); }
  830. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  831. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  832. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
  833. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  834. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  835. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  836. = round_toward_zero;
  837. };
  838. /// numeric_limits<unsigned int> specialization.
  839. template<>
  840. struct numeric_limits<unsigned int>
  841. {
  842. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  843. static _GLIBCXX_CONSTEXPR unsigned int
  844. min() _GLIBCXX_USE_NOEXCEPT { return 0; }
  845. static _GLIBCXX_CONSTEXPR unsigned int
  846. max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__ * 2U + 1; }
  847. #if __cplusplus >= 201103L
  848. static constexpr unsigned int
  849. lowest() noexcept { return min(); }
  850. #endif
  851. static _GLIBCXX_USE_CONSTEXPR int digits
  852. = __glibcxx_digits (unsigned int);
  853. static _GLIBCXX_USE_CONSTEXPR int digits10
  854. = __glibcxx_digits10 (unsigned int);
  855. #if __cplusplus >= 201103L
  856. static constexpr int max_digits10 = 0;
  857. #endif
  858. static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
  859. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  860. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  861. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  862. static _GLIBCXX_CONSTEXPR unsigned int
  863. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
  864. static _GLIBCXX_CONSTEXPR unsigned int
  865. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
  866. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  867. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  868. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  869. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  870. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  871. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  872. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  873. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  874. = denorm_absent;
  875. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  876. static _GLIBCXX_CONSTEXPR unsigned int
  877. infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned int>(0); }
  878. static _GLIBCXX_CONSTEXPR unsigned int
  879. quiet_NaN() _GLIBCXX_USE_NOEXCEPT
  880. { return static_cast<unsigned int>(0); }
  881. static _GLIBCXX_CONSTEXPR unsigned int
  882. signaling_NaN() _GLIBCXX_USE_NOEXCEPT
  883. { return static_cast<unsigned int>(0); }
  884. static _GLIBCXX_CONSTEXPR unsigned int
  885. denorm_min() _GLIBCXX_USE_NOEXCEPT
  886. { return static_cast<unsigned int>(0); }
  887. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  888. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  889. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
  890. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  891. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  892. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  893. = round_toward_zero;
  894. };
  895. /// numeric_limits<long> specialization.
  896. template<>
  897. struct numeric_limits<long>
  898. {
  899. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  900. static _GLIBCXX_CONSTEXPR long
  901. min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_MAX__ - 1; }
  902. static _GLIBCXX_CONSTEXPR long
  903. max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__; }
  904. #if __cplusplus >= 201103L
  905. static constexpr long
  906. lowest() noexcept { return min(); }
  907. #endif
  908. static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long);
  909. static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long);
  910. #if __cplusplus >= 201103L
  911. static constexpr int max_digits10 = 0;
  912. #endif
  913. static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
  914. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  915. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  916. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  917. static _GLIBCXX_CONSTEXPR long
  918. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
  919. static _GLIBCXX_CONSTEXPR long
  920. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
  921. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  922. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  923. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  924. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  925. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  926. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  927. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  928. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  929. = denorm_absent;
  930. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  931. static _GLIBCXX_CONSTEXPR long
  932. infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); }
  933. static _GLIBCXX_CONSTEXPR long
  934. quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); }
  935. static _GLIBCXX_CONSTEXPR long
  936. signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); }
  937. static _GLIBCXX_CONSTEXPR long
  938. denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); }
  939. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  940. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  941. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
  942. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  943. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  944. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  945. = round_toward_zero;
  946. };
  947. /// numeric_limits<unsigned long> specialization.
  948. template<>
  949. struct numeric_limits<unsigned long>
  950. {
  951. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  952. static _GLIBCXX_CONSTEXPR unsigned long
  953. min() _GLIBCXX_USE_NOEXCEPT { return 0; }
  954. static _GLIBCXX_CONSTEXPR unsigned long
  955. max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__ * 2UL + 1; }
  956. #if __cplusplus >= 201103L
  957. static constexpr unsigned long
  958. lowest() noexcept { return min(); }
  959. #endif
  960. static _GLIBCXX_USE_CONSTEXPR int digits
  961. = __glibcxx_digits (unsigned long);
  962. static _GLIBCXX_USE_CONSTEXPR int digits10
  963. = __glibcxx_digits10 (unsigned long);
  964. #if __cplusplus >= 201103L
  965. static constexpr int max_digits10 = 0;
  966. #endif
  967. static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
  968. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  969. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  970. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  971. static _GLIBCXX_CONSTEXPR unsigned long
  972. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
  973. static _GLIBCXX_CONSTEXPR unsigned long
  974. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
  975. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  976. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  977. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  978. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  979. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  980. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  981. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  982. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  983. = denorm_absent;
  984. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  985. static _GLIBCXX_CONSTEXPR unsigned long
  986. infinity() _GLIBCXX_USE_NOEXCEPT
  987. { return static_cast<unsigned long>(0); }
  988. static _GLIBCXX_CONSTEXPR unsigned long
  989. quiet_NaN() _GLIBCXX_USE_NOEXCEPT
  990. { return static_cast<unsigned long>(0); }
  991. static _GLIBCXX_CONSTEXPR unsigned long
  992. signaling_NaN() _GLIBCXX_USE_NOEXCEPT
  993. { return static_cast<unsigned long>(0); }
  994. static _GLIBCXX_CONSTEXPR unsigned long
  995. denorm_min() _GLIBCXX_USE_NOEXCEPT
  996. { return static_cast<unsigned long>(0); }
  997. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  998. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  999. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
  1000. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  1001. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  1002. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  1003. = round_toward_zero;
  1004. };
  1005. /// numeric_limits<long long> specialization.
  1006. template<>
  1007. struct numeric_limits<long long>
  1008. {
  1009. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  1010. static _GLIBCXX_CONSTEXPR long long
  1011. min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_LONG_MAX__ - 1; }
  1012. static _GLIBCXX_CONSTEXPR long long
  1013. max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__; }
  1014. #if __cplusplus >= 201103L
  1015. static constexpr long long
  1016. lowest() noexcept { return min(); }
  1017. #endif
  1018. static _GLIBCXX_USE_CONSTEXPR int digits
  1019. = __glibcxx_digits (long long);
  1020. static _GLIBCXX_USE_CONSTEXPR int digits10
  1021. = __glibcxx_digits10 (long long);
  1022. #if __cplusplus >= 201103L
  1023. static constexpr int max_digits10 = 0;
  1024. #endif
  1025. static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
  1026. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  1027. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  1028. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  1029. static _GLIBCXX_CONSTEXPR long long
  1030. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
  1031. static _GLIBCXX_CONSTEXPR long long
  1032. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
  1033. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  1034. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  1035. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  1036. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  1037. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  1038. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  1039. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  1040. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  1041. = denorm_absent;
  1042. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  1043. static _GLIBCXX_CONSTEXPR long long
  1044. infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); }
  1045. static _GLIBCXX_CONSTEXPR long long
  1046. quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); }
  1047. static _GLIBCXX_CONSTEXPR long long
  1048. signaling_NaN() _GLIBCXX_USE_NOEXCEPT
  1049. { return static_cast<long long>(0); }
  1050. static _GLIBCXX_CONSTEXPR long long
  1051. denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); }
  1052. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  1053. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  1054. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
  1055. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  1056. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  1057. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  1058. = round_toward_zero;
  1059. };
  1060. /// numeric_limits<unsigned long long> specialization.
  1061. template<>
  1062. struct numeric_limits<unsigned long long>
  1063. {
  1064. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  1065. static _GLIBCXX_CONSTEXPR unsigned long long
  1066. min() _GLIBCXX_USE_NOEXCEPT { return 0; }
  1067. static _GLIBCXX_CONSTEXPR unsigned long long
  1068. max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__ * 2ULL + 1; }
  1069. #if __cplusplus >= 201103L
  1070. static constexpr unsigned long long
  1071. lowest() noexcept { return min(); }
  1072. #endif
  1073. static _GLIBCXX_USE_CONSTEXPR int digits
  1074. = __glibcxx_digits (unsigned long long);
  1075. static _GLIBCXX_USE_CONSTEXPR int digits10
  1076. = __glibcxx_digits10 (unsigned long long);
  1077. #if __cplusplus >= 201103L
  1078. static constexpr int max_digits10 = 0;
  1079. #endif
  1080. static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
  1081. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
  1082. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
  1083. static _GLIBCXX_USE_CONSTEXPR int radix = 2;
  1084. static _GLIBCXX_CONSTEXPR unsigned long long
  1085. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
  1086. static _GLIBCXX_CONSTEXPR unsigned long long
  1087. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
  1088. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
  1089. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
  1090. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
  1091. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
  1092. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
  1093. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
  1094. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
  1095. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  1096. = denorm_absent;
  1097. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
  1098. static _GLIBCXX_CONSTEXPR unsigned long long
  1099. infinity() _GLIBCXX_USE_NOEXCEPT
  1100. { return static_cast<unsigned long long>(0); }
  1101. static _GLIBCXX_CONSTEXPR unsigned long long
  1102. quiet_NaN() _GLIBCXX_USE_NOEXCEPT
  1103. { return static_cast<unsigned long long>(0); }
  1104. static _GLIBCXX_CONSTEXPR unsigned long long
  1105. signaling_NaN() _GLIBCXX_USE_NOEXCEPT
  1106. { return static_cast<unsigned long long>(0); }
  1107. static _GLIBCXX_CONSTEXPR unsigned long long
  1108. denorm_min() _GLIBCXX_USE_NOEXCEPT
  1109. { return static_cast<unsigned long long>(0); }
  1110. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
  1111. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  1112. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
  1113. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
  1114. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
  1115. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  1116. = round_toward_zero;
  1117. };
  1118. #if !defined(__STRICT_ANSI__)
  1119. #define __INT_N(TYPE, BITSIZE, EXT, UEXT) \
  1120. template<> \
  1121. struct numeric_limits<TYPE> \
  1122. { \
  1123. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \
  1124. \
  1125. static _GLIBCXX_CONSTEXPR TYPE \
  1126. min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min_b (TYPE, BITSIZE); } \
  1127. \
  1128. static _GLIBCXX_CONSTEXPR TYPE \
  1129. max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE); } \
  1130. \
  1131. static _GLIBCXX_USE_CONSTEXPR int digits \
  1132. = BITSIZE - 1; \
  1133. static _GLIBCXX_USE_CONSTEXPR int digits10 \
  1134. = (BITSIZE - 1) * 643L / 2136; \
  1135. \
  1136. static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; \
  1137. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \
  1138. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \
  1139. static _GLIBCXX_USE_CONSTEXPR int radix = 2; \
  1140. \
  1141. static _GLIBCXX_CONSTEXPR TYPE \
  1142. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \
  1143. \
  1144. static _GLIBCXX_CONSTEXPR TYPE \
  1145. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \
  1146. \
  1147. EXT \
  1148. \
  1149. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \
  1150. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \
  1151. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \
  1152. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \
  1153. \
  1154. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \
  1155. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \
  1156. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \
  1157. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \
  1158. = denorm_absent; \
  1159. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \
  1160. \
  1161. static _GLIBCXX_CONSTEXPR TYPE \
  1162. infinity() _GLIBCXX_USE_NOEXCEPT \
  1163. { return static_cast<TYPE>(0); } \
  1164. \
  1165. static _GLIBCXX_CONSTEXPR TYPE \
  1166. quiet_NaN() _GLIBCXX_USE_NOEXCEPT \
  1167. { return static_cast<TYPE>(0); } \
  1168. \
  1169. static _GLIBCXX_CONSTEXPR TYPE \
  1170. signaling_NaN() _GLIBCXX_USE_NOEXCEPT \
  1171. { return static_cast<TYPE>(0); } \
  1172. \
  1173. static _GLIBCXX_CONSTEXPR TYPE \
  1174. denorm_min() _GLIBCXX_USE_NOEXCEPT \
  1175. { return static_cast<TYPE>(0); } \
  1176. \
  1177. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \
  1178. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \
  1179. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; \
  1180. \
  1181. static _GLIBCXX_USE_CONSTEXPR bool traps \
  1182. = __glibcxx_integral_traps; \
  1183. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \
  1184. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \
  1185. = round_toward_zero; \
  1186. }; \
  1187. \
  1188. template<> \
  1189. struct numeric_limits<unsigned TYPE> \
  1190. { \
  1191. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \
  1192. \
  1193. static _GLIBCXX_CONSTEXPR unsigned TYPE \
  1194. min() _GLIBCXX_USE_NOEXCEPT { return 0; } \
  1195. \
  1196. static _GLIBCXX_CONSTEXPR unsigned TYPE \
  1197. max() _GLIBCXX_USE_NOEXCEPT \
  1198. { return __glibcxx_max_b (unsigned TYPE, BITSIZE); } \
  1199. \
  1200. UEXT \
  1201. \
  1202. static _GLIBCXX_USE_CONSTEXPR int digits \
  1203. = BITSIZE; \
  1204. static _GLIBCXX_USE_CONSTEXPR int digits10 \
  1205. = BITSIZE * 643L / 2136; \
  1206. static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; \
  1207. static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \
  1208. static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \
  1209. static _GLIBCXX_USE_CONSTEXPR int radix = 2; \
  1210. \
  1211. static _GLIBCXX_CONSTEXPR unsigned TYPE \
  1212. epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \
  1213. \
  1214. static _GLIBCXX_CONSTEXPR unsigned TYPE \
  1215. round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \
  1216. \
  1217. static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \
  1218. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \
  1219. static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \
  1220. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \
  1221. \
  1222. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \
  1223. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \
  1224. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \
  1225. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \
  1226. = denorm_absent; \
  1227. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \
  1228. \
  1229. static _GLIBCXX_CONSTEXPR unsigned TYPE \
  1230. infinity() _GLIBCXX_USE_NOEXCEPT \
  1231. { return static_cast<unsigned TYPE>(0); } \
  1232. \
  1233. static _GLIBCXX_CONSTEXPR unsigned TYPE \
  1234. quiet_NaN() _GLIBCXX_USE_NOEXCEPT \
  1235. { return static_cast<unsigned TYPE>(0); } \
  1236. \
  1237. static _GLIBCXX_CONSTEXPR unsigned TYPE \
  1238. signaling_NaN() _GLIBCXX_USE_NOEXCEPT \
  1239. { return static_cast<unsigned TYPE>(0); } \
  1240. \
  1241. static _GLIBCXX_CONSTEXPR unsigned TYPE \
  1242. denorm_min() _GLIBCXX_USE_NOEXCEPT \
  1243. { return static_cast<unsigned TYPE>(0); } \
  1244. \
  1245. static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \
  1246. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \
  1247. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; \
  1248. \
  1249. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; \
  1250. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \
  1251. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \
  1252. = round_toward_zero; \
  1253. };
  1254. #if __cplusplus >= 201103L
  1255. #define __INT_N_201103(TYPE) \
  1256. static constexpr TYPE \
  1257. lowest() noexcept { return min(); } \
  1258. static constexpr int max_digits10 = 0;
  1259. #define __INT_N_U201103(TYPE) \
  1260. static constexpr unsigned TYPE \
  1261. lowest() noexcept { return min(); } \
  1262. static constexpr int max_digits10 = 0;
  1263. #else
  1264. #define __INT_N_201103(TYPE)
  1265. #define __INT_N_U201103(TYPE)
  1266. #endif
  1267. #ifdef __GLIBCXX_TYPE_INT_N_0
  1268. __INT_N(__GLIBCXX_TYPE_INT_N_0, __GLIBCXX_BITSIZE_INT_N_0,
  1269. __INT_N_201103 (__GLIBCXX_TYPE_INT_N_0), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_0))
  1270. #endif
  1271. #ifdef __GLIBCXX_TYPE_INT_N_1
  1272. __INT_N (__GLIBCXX_TYPE_INT_N_1, __GLIBCXX_BITSIZE_INT_N_1,
  1273. __INT_N_201103 (__GLIBCXX_TYPE_INT_N_1), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_1))
  1274. #endif
  1275. #ifdef __GLIBCXX_TYPE_INT_N_2
  1276. __INT_N (__GLIBCXX_TYPE_INT_N_2, __GLIBCXX_BITSIZE_INT_N_2,
  1277. __INT_N_201103 (__GLIBCXX_TYPE_INT_N_2), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_2))
  1278. #endif
  1279. #ifdef __GLIBCXX_TYPE_INT_N_3
  1280. __INT_N (__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3,
  1281. __INT_N_201103 (__GLIBCXX_TYPE_INT_N_3), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_3))
  1282. #endif
  1283. #undef __INT_N
  1284. #undef __INT_N_201103
  1285. #undef __INT_N_U201103
  1286. #endif
  1287. /// numeric_limits<float> specialization.
  1288. template<>
  1289. struct numeric_limits<float>
  1290. {
  1291. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  1292. static _GLIBCXX_CONSTEXPR float
  1293. min() _GLIBCXX_USE_NOEXCEPT { return __FLT_MIN__; }
  1294. static _GLIBCXX_CONSTEXPR float
  1295. max() _GLIBCXX_USE_NOEXCEPT { return __FLT_MAX__; }
  1296. #if __cplusplus >= 201103L
  1297. static constexpr float
  1298. lowest() noexcept { return -__FLT_MAX__; }
  1299. #endif
  1300. static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__;
  1301. static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__;
  1302. #if __cplusplus >= 201103L
  1303. static constexpr int max_digits10
  1304. = __glibcxx_max_digits10 (__FLT_MANT_DIG__);
  1305. #endif
  1306. static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
  1307. static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
  1308. static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
  1309. static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
  1310. static _GLIBCXX_CONSTEXPR float
  1311. epsilon() _GLIBCXX_USE_NOEXCEPT { return __FLT_EPSILON__; }
  1312. static _GLIBCXX_CONSTEXPR float
  1313. round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5F; }
  1314. static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__;
  1315. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__;
  1316. static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__;
  1317. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__;
  1318. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__;
  1319. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
  1320. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
  1321. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  1322. = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;
  1323. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
  1324. = __glibcxx_float_has_denorm_loss;
  1325. static _GLIBCXX_CONSTEXPR float
  1326. infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_valf(); }
  1327. static _GLIBCXX_CONSTEXPR float
  1328. quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanf(""); }
  1329. static _GLIBCXX_CONSTEXPR float
  1330. signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansf(""); }
  1331. static _GLIBCXX_CONSTEXPR float
  1332. denorm_min() _GLIBCXX_USE_NOEXCEPT { return __FLT_DENORM_MIN__; }
  1333. static _GLIBCXX_USE_CONSTEXPR bool is_iec559
  1334. = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
  1335. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  1336. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
  1337. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps;
  1338. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before
  1339. = __glibcxx_float_tinyness_before;
  1340. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  1341. = round_to_nearest;
  1342. };
  1343. #undef __glibcxx_float_has_denorm_loss
  1344. #undef __glibcxx_float_traps
  1345. #undef __glibcxx_float_tinyness_before
  1346. /// numeric_limits<double> specialization.
  1347. template<>
  1348. struct numeric_limits<double>
  1349. {
  1350. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  1351. static _GLIBCXX_CONSTEXPR double
  1352. min() _GLIBCXX_USE_NOEXCEPT { return __DBL_MIN__; }
  1353. static _GLIBCXX_CONSTEXPR double
  1354. max() _GLIBCXX_USE_NOEXCEPT { return __DBL_MAX__; }
  1355. #if __cplusplus >= 201103L
  1356. static constexpr double
  1357. lowest() noexcept { return -__DBL_MAX__; }
  1358. #endif
  1359. static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__;
  1360. static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__;
  1361. #if __cplusplus >= 201103L
  1362. static constexpr int max_digits10
  1363. = __glibcxx_max_digits10 (__DBL_MANT_DIG__);
  1364. #endif
  1365. static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
  1366. static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
  1367. static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
  1368. static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
  1369. static _GLIBCXX_CONSTEXPR double
  1370. epsilon() _GLIBCXX_USE_NOEXCEPT { return __DBL_EPSILON__; }
  1371. static _GLIBCXX_CONSTEXPR double
  1372. round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5; }
  1373. static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__;
  1374. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__;
  1375. static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__;
  1376. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__;
  1377. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__;
  1378. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
  1379. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
  1380. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  1381. = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent;
  1382. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
  1383. = __glibcxx_double_has_denorm_loss;
  1384. static _GLIBCXX_CONSTEXPR double
  1385. infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_val(); }
  1386. static _GLIBCXX_CONSTEXPR double
  1387. quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nan(""); }
  1388. static _GLIBCXX_CONSTEXPR double
  1389. signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nans(""); }
  1390. static _GLIBCXX_CONSTEXPR double
  1391. denorm_min() _GLIBCXX_USE_NOEXCEPT { return __DBL_DENORM_MIN__; }
  1392. static _GLIBCXX_USE_CONSTEXPR bool is_iec559
  1393. = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
  1394. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  1395. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
  1396. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps;
  1397. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before
  1398. = __glibcxx_double_tinyness_before;
  1399. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
  1400. = round_to_nearest;
  1401. };
  1402. #undef __glibcxx_double_has_denorm_loss
  1403. #undef __glibcxx_double_traps
  1404. #undef __glibcxx_double_tinyness_before
  1405. /// numeric_limits<long double> specialization.
  1406. template<>
  1407. struct numeric_limits<long double>
  1408. {
  1409. static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
  1410. static _GLIBCXX_CONSTEXPR long double
  1411. min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MIN__; }
  1412. static _GLIBCXX_CONSTEXPR long double
  1413. max() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MAX__; }
  1414. #if __cplusplus >= 201103L
  1415. static constexpr long double
  1416. lowest() noexcept { return -__LDBL_MAX__; }
  1417. #endif
  1418. static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__;
  1419. static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__;
  1420. #if __cplusplus >= 201103L
  1421. static _GLIBCXX_USE_CONSTEXPR int max_digits10
  1422. = __glibcxx_max_digits10 (__LDBL_MANT_DIG__);
  1423. #endif
  1424. static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
  1425. static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
  1426. static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
  1427. static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
  1428. static _GLIBCXX_CONSTEXPR long double
  1429. epsilon() _GLIBCXX_USE_NOEXCEPT { return __LDBL_EPSILON__; }
  1430. static _GLIBCXX_CONSTEXPR long double
  1431. round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5L; }
  1432. static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__;
  1433. static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__;
  1434. static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__;
  1435. static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__;
  1436. static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__;
  1437. static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
  1438. static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
  1439. static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
  1440. = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent;
  1441. static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
  1442. = __glibcxx_long_double_has_denorm_loss;
  1443. static _GLIBCXX_CONSTEXPR long double
  1444. infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_vall(); }
  1445. static _GLIBCXX_CONSTEXPR long double
  1446. quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanl(""); }
  1447. static _GLIBCXX_CONSTEXPR long double
  1448. signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansl(""); }
  1449. static _GLIBCXX_CONSTEXPR long double
  1450. denorm_min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_DENORM_MIN__; }
  1451. static _GLIBCXX_USE_CONSTEXPR bool is_iec559
  1452. = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
  1453. static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
  1454. static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
  1455. static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps;
  1456. static _GLIBCXX_USE_CONSTEXPR bool tinyness_before =
  1457. __glibcxx_long_double_tinyness_before;
  1458. static _GLIBCXX_USE_CONSTEXPR float_round_style round_style =
  1459. round_to_nearest;
  1460. };
  1461. #undef __glibcxx_long_double_has_denorm_loss
  1462. #undef __glibcxx_long_double_traps
  1463. #undef __glibcxx_long_double_tinyness_before
  1464. _GLIBCXX_END_NAMESPACE_VERSION
  1465. } // namespace
  1466. #undef __glibcxx_signed
  1467. #undef __glibcxx_min
  1468. #undef __glibcxx_max
  1469. #undef __glibcxx_digits
  1470. #undef __glibcxx_digits10
  1471. #undef __glibcxx_max_digits10
  1472. #endif // _GLIBCXX_NUMERIC_LIMITS