Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

il y a 3 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. // decimal classes -*- C++ -*-
  2. // Copyright (C) 2009-2020 Free Software Foundation, Inc.
  3. // This file is part of the GNU ISO C++ Library. This library is free
  4. // software; you can redistribute it and/or modify it under the
  5. // terms of the GNU General Public License as published by the
  6. // Free Software Foundation; either version 3, or (at your option)
  7. // any later version.
  8. // This library is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. // Under Section 7 of GPL version 3, you are granted additional
  13. // permissions described in the GCC Runtime Library Exception, version
  14. // 3.1, as published by the Free Software Foundation.
  15. // You should have received a copy of the GNU General Public License and
  16. // a copy of the GCC Runtime Library Exception along with this program;
  17. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  18. // <http://www.gnu.org/licenses/>.
  19. /** @file decimal/decimal.h
  20. * This is an internal header file, included by other library headers.
  21. * Do not attempt to use it directly. @headername{decimal}
  22. */
  23. // ISO/IEC TR 24733
  24. // Written by Janis Johnson <janis187@us.ibm.com>
  25. #ifndef _GLIBCXX_DECIMAL_IMPL
  26. #define _GLIBCXX_DECIMAL_IMPL 1
  27. #pragma GCC system_header
  28. namespace std _GLIBCXX_VISIBILITY(default)
  29. {
  30. _GLIBCXX_BEGIN_NAMESPACE_VERSION
  31. namespace decimal
  32. {
  33. // ISO/IEC TR 24733 3.2.[234].1 Construct/copy/destroy.
  34. inline decimal32::decimal32(decimal64 __r) : __val(__r.__getval()) {}
  35. inline decimal32::decimal32(decimal128 __r) : __val(__r.__getval()) {}
  36. inline decimal64::decimal64(decimal32 __r) : __val(__r.__getval()) {}
  37. inline decimal64::decimal64(decimal128 __r) : __val(__r.__getval()) {}
  38. inline decimal128::decimal128(decimal32 __r) : __val(__r.__getval()) {}
  39. inline decimal128::decimal128(decimal64 __r) : __val(__r.__getval()) {}
  40. // ISO/IEC TR 24733 3.2.[234].6 Compound assignment.
  41. #define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, _T2) \
  42. inline _T1& _T1::operator _Op1(_T2 __rhs) \
  43. { \
  44. __setval(__getval() _Op2 __rhs.__getval()); \
  45. return *this; \
  46. }
  47. #define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, _T2) \
  48. inline _T1& _T1::operator _Op1(_T2 __rhs) \
  49. { \
  50. __setval(__getval() _Op2 __rhs); \
  51. return *this; \
  52. }
  53. #define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(_Op1, _Op2, _T1) \
  54. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal32) \
  55. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal64) \
  56. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal128) \
  57. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, int) \
  58. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned int) \
  59. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, long) \
  60. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned long)\
  61. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, long long) \
  62. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned long long)
  63. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal32)
  64. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal32)
  65. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal32)
  66. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal32)
  67. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal64)
  68. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal64)
  69. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal64)
  70. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal64)
  71. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal128)
  72. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal128)
  73. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal128)
  74. _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal128)
  75. #undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC
  76. #undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT
  77. #undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS
  78. // Extension: Conversion to integral type.
  79. inline long long decimal32_to_long_long(decimal32 __d)
  80. { return (long long)__d.__getval(); }
  81. inline long long decimal64_to_long_long(decimal64 __d)
  82. { return (long long)__d.__getval(); }
  83. inline long long decimal128_to_long_long(decimal128 __d)
  84. { return (long long)__d.__getval(); }
  85. inline long long decimal_to_long_long(decimal32 __d)
  86. { return (long long)__d.__getval(); }
  87. inline long long decimal_to_long_long(decimal64 __d)
  88. { return (long long)__d.__getval(); }
  89. inline long long decimal_to_long_long(decimal128 __d)
  90. { return (long long)__d.__getval(); }
  91. // ISO/IEC TR 24733 3.2.5 Initialization from coefficient and exponent.
  92. static decimal32 make_decimal32(long long __coeff, int __exponent)
  93. {
  94. decimal32 __decexp = 1, __multiplier;
  95. if (__exponent < 0)
  96. {
  97. __multiplier = 1.E-1DF;
  98. __exponent = -__exponent;
  99. }
  100. else
  101. __multiplier = 1.E1DF;
  102. for (int __i = 0; __i < __exponent; ++__i)
  103. __decexp *= __multiplier;
  104. return __coeff * __decexp;
  105. }
  106. static decimal32 make_decimal32(unsigned long long __coeff, int __exponent)
  107. {
  108. decimal32 __decexp = 1, __multiplier;
  109. if (__exponent < 0)
  110. {
  111. __multiplier = 1.E-1DF;
  112. __exponent = -__exponent;
  113. }
  114. else
  115. __multiplier = 1.E1DF;
  116. for (int __i = 0; __i < __exponent; ++__i)
  117. __decexp *= __multiplier;
  118. return __coeff * __decexp;
  119. }
  120. static decimal64 make_decimal64(long long __coeff, int __exponent)
  121. {
  122. decimal64 __decexp = 1, __multiplier;
  123. if (__exponent < 0)
  124. {
  125. __multiplier = 1.E-1DD;
  126. __exponent = -__exponent;
  127. }
  128. else
  129. __multiplier = 1.E1DD;
  130. for (int __i = 0; __i < __exponent; ++__i)
  131. __decexp *= __multiplier;
  132. return __coeff * __decexp;
  133. }
  134. static decimal64 make_decimal64(unsigned long long __coeff, int __exponent)
  135. {
  136. decimal64 __decexp = 1, __multiplier;
  137. if (__exponent < 0)
  138. {
  139. __multiplier = 1.E-1DD;
  140. __exponent = -__exponent;
  141. }
  142. else
  143. __multiplier = 1.E1DD;
  144. for (int __i = 0; __i < __exponent; ++__i)
  145. __decexp *= __multiplier;
  146. return __coeff * __decexp;
  147. }
  148. static decimal128 make_decimal128(long long __coeff, int __exponent)
  149. {
  150. decimal128 __decexp = 1, __multiplier;
  151. if (__exponent < 0)
  152. {
  153. __multiplier = 1.E-1DL;
  154. __exponent = -__exponent;
  155. }
  156. else
  157. __multiplier = 1.E1DL;
  158. for (int __i = 0; __i < __exponent; ++__i)
  159. __decexp *= __multiplier;
  160. return __coeff * __decexp;
  161. }
  162. static decimal128 make_decimal128(unsigned long long __coeff, int __exponent)
  163. {
  164. decimal128 __decexp = 1, __multiplier;
  165. if (__exponent < 0)
  166. {
  167. __multiplier = 1.E-1DL;
  168. __exponent = -__exponent;
  169. }
  170. else
  171. __multiplier = 1.E1DL;
  172. for (int __i = 0; __i < __exponent; ++__i)
  173. __decexp *= __multiplier;
  174. return __coeff * __decexp;
  175. }
  176. // ISO/IEC TR 24733 3.2.6 Conversion to generic floating-point type.
  177. inline float decimal32_to_float(decimal32 __d)
  178. { return (float)__d.__getval(); }
  179. inline float decimal64_to_float(decimal64 __d)
  180. { return (float)__d.__getval(); }
  181. inline float decimal128_to_float(decimal128 __d)
  182. { return (float)__d.__getval(); }
  183. inline float decimal_to_float(decimal32 __d)
  184. { return (float)__d.__getval(); }
  185. inline float decimal_to_float(decimal64 __d)
  186. { return (float)__d.__getval(); }
  187. inline float decimal_to_float(decimal128 __d)
  188. { return (float)__d.__getval(); }
  189. inline double decimal32_to_double(decimal32 __d)
  190. { return (double)__d.__getval(); }
  191. inline double decimal64_to_double(decimal64 __d)
  192. { return (double)__d.__getval(); }
  193. inline double decimal128_to_double(decimal128 __d)
  194. { return (double)__d.__getval(); }
  195. inline double decimal_to_double(decimal32 __d)
  196. { return (double)__d.__getval(); }
  197. inline double decimal_to_double(decimal64 __d)
  198. { return (double)__d.__getval(); }
  199. inline double decimal_to_double(decimal128 __d)
  200. { return (double)__d.__getval(); }
  201. inline long double decimal32_to_long_double(decimal32 __d)
  202. { return (long double)__d.__getval(); }
  203. inline long double decimal64_to_long_double(decimal64 __d)
  204. { return (long double)__d.__getval(); }
  205. inline long double decimal128_to_long_double(decimal128 __d)
  206. { return (long double)__d.__getval(); }
  207. inline long double decimal_to_long_double(decimal32 __d)
  208. { return (long double)__d.__getval(); }
  209. inline long double decimal_to_long_double(decimal64 __d)
  210. { return (long double)__d.__getval(); }
  211. inline long double decimal_to_long_double(decimal128 __d)
  212. { return (long double)__d.__getval(); }
  213. // ISO/IEC TR 24733 3.2.7 Unary arithmetic operators.
  214. #define _DEFINE_DECIMAL_UNARY_OP(_Op, _Tp) \
  215. inline _Tp operator _Op(_Tp __rhs) \
  216. { \
  217. _Tp __tmp; \
  218. __tmp.__setval(_Op __rhs.__getval()); \
  219. return __tmp; \
  220. }
  221. _DEFINE_DECIMAL_UNARY_OP(+, decimal32)
  222. _DEFINE_DECIMAL_UNARY_OP(+, decimal64)
  223. _DEFINE_DECIMAL_UNARY_OP(+, decimal128)
  224. _DEFINE_DECIMAL_UNARY_OP(-, decimal32)
  225. _DEFINE_DECIMAL_UNARY_OP(-, decimal64)
  226. _DEFINE_DECIMAL_UNARY_OP(-, decimal128)
  227. #undef _DEFINE_DECIMAL_UNARY_OP
  228. // ISO/IEC TR 24733 3.2.8 Binary arithmetic operators.
  229. #define _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(_Op, _T1, _T2, _T3) \
  230. inline _T1 operator _Op(_T2 __lhs, _T3 __rhs) \
  231. { \
  232. _T1 __retval; \
  233. __retval.__setval(__lhs.__getval() _Op __rhs.__getval()); \
  234. return __retval; \
  235. }
  236. #define _DEFINE_DECIMAL_BINARY_OP_BOTH(_Op, _T1, _T2, _T3) \
  237. inline _T1 operator _Op(_T2 __lhs, _T3 __rhs) \
  238. { \
  239. _T1 __retval; \
  240. __retval.__setval(__lhs.__getval() _Op __rhs.__getval()); \
  241. return __retval; \
  242. }
  243. #define _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, _T2) \
  244. inline _T1 operator _Op(_T1 __lhs, _T2 __rhs) \
  245. { \
  246. _T1 __retval; \
  247. __retval.__setval(__lhs.__getval() _Op __rhs); \
  248. return __retval; \
  249. }
  250. #define _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, _T2) \
  251. inline _T1 operator _Op(_T2 __lhs, _T1 __rhs) \
  252. { \
  253. _T1 __retval; \
  254. __retval.__setval(__lhs _Op __rhs.__getval()); \
  255. return __retval; \
  256. }
  257. #define _DEFINE_DECIMAL_BINARY_OP_WITH_INT(_Op, _T1) \
  258. _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, int); \
  259. _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned int); \
  260. _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, long); \
  261. _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned long); \
  262. _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, long long); \
  263. _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned long long); \
  264. _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, int); \
  265. _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned int); \
  266. _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, long); \
  267. _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned long); \
  268. _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, long long); \
  269. _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned long long); \
  270. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal32, decimal32, decimal32)
  271. _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal32)
  272. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal32, decimal64)
  273. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal32)
  274. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal64)
  275. _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal64)
  276. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal32, decimal128)
  277. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal64, decimal128)
  278. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal32)
  279. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal64)
  280. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal128)
  281. _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal128)
  282. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal32, decimal32, decimal32)
  283. _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal32)
  284. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal32, decimal64)
  285. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal32)
  286. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal64)
  287. _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal64)
  288. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal32, decimal128)
  289. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal64, decimal128)
  290. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal32)
  291. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal64)
  292. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal128)
  293. _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal128)
  294. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal32, decimal32, decimal32)
  295. _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal32)
  296. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal32, decimal64)
  297. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal32)
  298. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal64)
  299. _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal64)
  300. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal32, decimal128)
  301. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal64, decimal128)
  302. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal32)
  303. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal64)
  304. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal128)
  305. _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal128)
  306. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal32, decimal32, decimal32)
  307. _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal32)
  308. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal32, decimal64)
  309. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal32)
  310. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal64)
  311. _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal64)
  312. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal32, decimal128)
  313. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal64, decimal128)
  314. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal32)
  315. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal64)
  316. _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal128)
  317. _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal128)
  318. #undef _DEFINE_DECIMAL_BINARY_OP_WITH_DEC
  319. #undef _DEFINE_DECIMAL_BINARY_OP_BOTH
  320. #undef _DEFINE_DECIMAL_BINARY_OP_LHS
  321. #undef _DEFINE_DECIMAL_BINARY_OP_RHS
  322. #undef _DEFINE_DECIMAL_BINARY_OP_WITH_INT
  323. // ISO/IEC TR 24733 3.2.9 Comparison operators.
  324. #define _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _T1, _T2) \
  325. inline bool operator _Op(_T1 __lhs, _T2 __rhs) \
  326. { return __lhs.__getval() _Op __rhs.__getval(); }
  327. #define _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _T1, _T2) \
  328. inline bool operator _Op(_T1 __lhs, _T2 __rhs) \
  329. { return __lhs.__getval() _Op __rhs; }
  330. #define _DEFINE_DECIMAL_COMPARISON_RHS(_Op, _T1, _T2) \
  331. inline bool operator _Op(_T1 __lhs, _T2 __rhs) \
  332. { return __lhs _Op __rhs.__getval(); }
  333. #define _DEFINE_DECIMAL_COMPARISONS(_Op, _Tp) \
  334. _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal32) \
  335. _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal64) \
  336. _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal128) \
  337. _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, int) \
  338. _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned int) \
  339. _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, long) \
  340. _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned long) \
  341. _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, long long) \
  342. _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned long long) \
  343. _DEFINE_DECIMAL_COMPARISON_RHS(_Op, int, _Tp) \
  344. _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned int, _Tp) \
  345. _DEFINE_DECIMAL_COMPARISON_RHS(_Op, long, _Tp) \
  346. _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned long, _Tp) \
  347. _DEFINE_DECIMAL_COMPARISON_RHS(_Op, long long, _Tp) \
  348. _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned long long, _Tp)
  349. _DEFINE_DECIMAL_COMPARISONS(==, decimal32)
  350. _DEFINE_DECIMAL_COMPARISONS(==, decimal64)
  351. _DEFINE_DECIMAL_COMPARISONS(==, decimal128)
  352. _DEFINE_DECIMAL_COMPARISONS(!=, decimal32)
  353. _DEFINE_DECIMAL_COMPARISONS(!=, decimal64)
  354. _DEFINE_DECIMAL_COMPARISONS(!=, decimal128)
  355. _DEFINE_DECIMAL_COMPARISONS(<, decimal32)
  356. _DEFINE_DECIMAL_COMPARISONS(<, decimal64)
  357. _DEFINE_DECIMAL_COMPARISONS(<, decimal128)
  358. _DEFINE_DECIMAL_COMPARISONS(<=, decimal32)
  359. _DEFINE_DECIMAL_COMPARISONS(<=, decimal64)
  360. _DEFINE_DECIMAL_COMPARISONS(<=, decimal128)
  361. _DEFINE_DECIMAL_COMPARISONS(>, decimal32)
  362. _DEFINE_DECIMAL_COMPARISONS(>, decimal64)
  363. _DEFINE_DECIMAL_COMPARISONS(>, decimal128)
  364. _DEFINE_DECIMAL_COMPARISONS(>=, decimal32)
  365. _DEFINE_DECIMAL_COMPARISONS(>=, decimal64)
  366. _DEFINE_DECIMAL_COMPARISONS(>=, decimal128)
  367. #undef _DEFINE_DECIMAL_COMPARISON_BOTH
  368. #undef _DEFINE_DECIMAL_COMPARISON_LHS
  369. #undef _DEFINE_DECIMAL_COMPARISON_RHS
  370. #undef _DEFINE_DECIMAL_COMPARISONS
  371. } // namespace decimal
  372. _GLIBCXX_END_NAMESPACE_VERSION
  373. } // namespace std
  374. #endif /* _GLIBCXX_DECIMAL_IMPL */