float.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. /* Copyright (C) 2002-2022 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. GCC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. /*
  19. * ISO C Standard: 5.2.4.2.2 Characteristics of floating types <float.h>
  20. */
  21. #ifndef _FLOAT_H___
  22. #define _FLOAT_H___
  23. /* Radix of exponent representation, b. */
  24. #undef FLT_RADIX
  25. #define FLT_RADIX __FLT_RADIX__
  26. /* Number of base-FLT_RADIX digits in the significand, p. */
  27. #undef FLT_MANT_DIG
  28. #undef DBL_MANT_DIG
  29. #undef LDBL_MANT_DIG
  30. #define FLT_MANT_DIG __FLT_MANT_DIG__
  31. #define DBL_MANT_DIG __DBL_MANT_DIG__
  32. #define LDBL_MANT_DIG __LDBL_MANT_DIG__
  33. /* Number of decimal digits, q, such that any floating-point number with q
  34. decimal digits can be rounded into a floating-point number with p radix b
  35. digits and back again without change to the q decimal digits,
  36. p * log10(b) if b is a power of 10
  37. floor((p - 1) * log10(b)) otherwise
  38. */
  39. #undef FLT_DIG
  40. #undef DBL_DIG
  41. #undef LDBL_DIG
  42. #define FLT_DIG __FLT_DIG__
  43. #define DBL_DIG __DBL_DIG__
  44. #define LDBL_DIG __LDBL_DIG__
  45. /* Minimum int x such that FLT_RADIX**(x-1) is a normalized float, emin */
  46. #undef FLT_MIN_EXP
  47. #undef DBL_MIN_EXP
  48. #undef LDBL_MIN_EXP
  49. #define FLT_MIN_EXP __FLT_MIN_EXP__
  50. #define DBL_MIN_EXP __DBL_MIN_EXP__
  51. #define LDBL_MIN_EXP __LDBL_MIN_EXP__
  52. /* Minimum negative integer such that 10 raised to that power is in the
  53. range of normalized floating-point numbers,
  54. ceil(log10(b) * (emin - 1))
  55. */
  56. #undef FLT_MIN_10_EXP
  57. #undef DBL_MIN_10_EXP
  58. #undef LDBL_MIN_10_EXP
  59. #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
  60. #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
  61. #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
  62. /* Maximum int x such that FLT_RADIX**(x-1) is a representable float, emax. */
  63. #undef FLT_MAX_EXP
  64. #undef DBL_MAX_EXP
  65. #undef LDBL_MAX_EXP
  66. #define FLT_MAX_EXP __FLT_MAX_EXP__
  67. #define DBL_MAX_EXP __DBL_MAX_EXP__
  68. #define LDBL_MAX_EXP __LDBL_MAX_EXP__
  69. /* Maximum integer such that 10 raised to that power is in the range of
  70. representable finite floating-point numbers,
  71. floor(log10((1 - b**-p) * b**emax))
  72. */
  73. #undef FLT_MAX_10_EXP
  74. #undef DBL_MAX_10_EXP
  75. #undef LDBL_MAX_10_EXP
  76. #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
  77. #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
  78. #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
  79. /* Maximum representable finite floating-point number,
  80. (1 - b**-p) * b**emax
  81. */
  82. #undef FLT_MAX
  83. #undef DBL_MAX
  84. #undef LDBL_MAX
  85. #define FLT_MAX __FLT_MAX__
  86. #define DBL_MAX __DBL_MAX__
  87. #define LDBL_MAX __LDBL_MAX__
  88. /* The difference between 1 and the least value greater than 1 that is
  89. representable in the given floating point type, b**1-p. */
  90. #undef FLT_EPSILON
  91. #undef DBL_EPSILON
  92. #undef LDBL_EPSILON
  93. #define FLT_EPSILON __FLT_EPSILON__
  94. #define DBL_EPSILON __DBL_EPSILON__
  95. #define LDBL_EPSILON __LDBL_EPSILON__
  96. /* Minimum normalized positive floating-point number, b**(emin - 1). */
  97. #undef FLT_MIN
  98. #undef DBL_MIN
  99. #undef LDBL_MIN
  100. #define FLT_MIN __FLT_MIN__
  101. #define DBL_MIN __DBL_MIN__
  102. #define LDBL_MIN __LDBL_MIN__
  103. /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown. */
  104. /* ??? This is supposed to change with calls to fesetround in <fenv.h>. */
  105. #undef FLT_ROUNDS
  106. #define FLT_ROUNDS 1
  107. #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
  108. || (defined (__cplusplus) && __cplusplus >= 201103L)
  109. /* The floating-point expression evaluation method. The precise
  110. definitions of these values are generalised to include support for
  111. the interchange and extended types defined in ISO/IEC TS 18661-3.
  112. Prior to this (for C99/C11) the definitions were:
  113. -1 indeterminate
  114. 0 evaluate all operations and constants just to the range and
  115. precision of the type
  116. 1 evaluate operations and constants of type float and double
  117. to the range and precision of the double type, evaluate
  118. long double operations and constants to the range and
  119. precision of the long double type
  120. 2 evaluate all operations and constants to the range and
  121. precision of the long double type
  122. The TS 18661-3 definitions are:
  123. -1 indeterminate
  124. 0 evaluate all operations and constants, whose semantic type has
  125. at most the range and precision of float, to the range and
  126. precision of float; evaluate all other operations and constants
  127. to the range and precision of the semantic type.
  128. 1 evaluate all operations and constants, whose semantic type has
  129. at most the range and precision of double, to the range and
  130. precision of double; evaluate all other operations and constants
  131. to the range and precision of the semantic type.
  132. 2 evaluate all operations and constants, whose semantic type has
  133. at most the range and precision of long double, to the range and
  134. precision of long double; evaluate all other operations and
  135. constants to the range and precision of the semantic type.
  136. N where _FloatN is a supported interchange floating type
  137. evaluate all operations and constants, whose semantic type has
  138. at most the range and precision of the _FloatN type, to the
  139. range and precision of the _FloatN type; evaluate all other
  140. operations and constants to the range and precision of the
  141. semantic type.
  142. N + 1, where _FloatNx is a supported extended floating type
  143. evaluate operations and constants, whose semantic type has at
  144. most the range and precision of the _FloatNx type, to the range
  145. and precision of the _FloatNx type; evaluate all other
  146. operations and constants to the range and precision of the
  147. semantic type.
  148. The compiler predefines two macros:
  149. __FLT_EVAL_METHOD__
  150. Which, depending on the value given for
  151. -fpermitted-flt-eval-methods, may be limited to only those values
  152. for FLT_EVAL_METHOD defined in C99/C11.
  153. __FLT_EVAL_METHOD_TS_18661_3__
  154. Which always permits the values for FLT_EVAL_METHOD defined in
  155. ISO/IEC TS 18661-3.
  156. Here we want to use __FLT_EVAL_METHOD__, unless
  157. __STDC_WANT_IEC_60559_TYPES_EXT__ is defined, in which case the user
  158. is specifically asking for the ISO/IEC TS 18661-3 types, so we use
  159. __FLT_EVAL_METHOD_TS_18661_3__.
  160. ??? This ought to change with the setting of the fp control word;
  161. the value provided by the compiler assumes the widest setting. */
  162. #undef FLT_EVAL_METHOD
  163. #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
  164. #define FLT_EVAL_METHOD __FLT_EVAL_METHOD_TS_18661_3__
  165. #else
  166. #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
  167. #endif
  168. /* Number of decimal digits, n, such that any floating-point number in the
  169. widest supported floating type with pmax radix b digits can be rounded
  170. to a floating-point number with n decimal digits and back again without
  171. change to the value,
  172. pmax * log10(b) if b is a power of 10
  173. ceil(1 + pmax * log10(b)) otherwise
  174. */
  175. #undef DECIMAL_DIG
  176. #define DECIMAL_DIG __DECIMAL_DIG__
  177. #endif /* C99 */
  178. #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
  179. || (defined (__cplusplus) && __cplusplus >= 201703L)
  180. /* Versions of DECIMAL_DIG for each floating-point type. */
  181. #undef FLT_DECIMAL_DIG
  182. #undef DBL_DECIMAL_DIG
  183. #undef LDBL_DECIMAL_DIG
  184. #define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
  185. #define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
  186. #define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
  187. /* Whether types support subnormal numbers. */
  188. #undef FLT_HAS_SUBNORM
  189. #undef DBL_HAS_SUBNORM
  190. #undef LDBL_HAS_SUBNORM
  191. #define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
  192. #define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
  193. #define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
  194. /* Minimum positive values, including subnormals. */
  195. #undef FLT_TRUE_MIN
  196. #undef DBL_TRUE_MIN
  197. #undef LDBL_TRUE_MIN
  198. #define FLT_TRUE_MIN __FLT_DENORM_MIN__
  199. #define DBL_TRUE_MIN __DBL_DENORM_MIN__
  200. #define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
  201. #endif /* C11 */
  202. #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
  203. /* Maximum finite positive value with MANT_DIG digits in the
  204. significand taking their maximum value. */
  205. #undef FLT_NORM_MAX
  206. #undef DBL_NORM_MAX
  207. #undef LDBL_NORM_MAX
  208. #define FLT_NORM_MAX __FLT_NORM_MAX__
  209. #define DBL_NORM_MAX __DBL_NORM_MAX__
  210. #define LDBL_NORM_MAX __LDBL_NORM_MAX__
  211. /* Whether each type matches an IEC 60559 format (1 for format, 2 for
  212. format and operations). */
  213. #undef FLT_IS_IEC_60559
  214. #undef DBL_IS_IEC_60559
  215. #undef LDBL_IS_IEC_60559
  216. #define FLT_IS_IEC_60559 __FLT_IS_IEC_60559__
  217. #define DBL_IS_IEC_60559 __DBL_IS_IEC_60559__
  218. #define LDBL_IS_IEC_60559 __LDBL_IS_IEC_60559__
  219. /* Infinity in type float, or overflow if infinity not supported. */
  220. #undef INFINITY
  221. #define INFINITY (__builtin_inff ())
  222. /* Quiet NaN, if supported for float. */
  223. #if __FLT_HAS_QUIET_NAN__
  224. #undef NAN
  225. #define NAN (__builtin_nanf (""))
  226. #endif
  227. /* Signaling NaN, if supported for each type. All formats supported
  228. by GCC support either both quiet and signaling NaNs, or neither
  229. kind of NaN. */
  230. #if __FLT_HAS_QUIET_NAN__
  231. #undef FLT_SNAN
  232. #define FLT_SNAN (__builtin_nansf (""))
  233. #endif
  234. #if __DBL_HAS_QUIET_NAN__
  235. #undef DBL_SNAN
  236. #define DBL_SNAN (__builtin_nans (""))
  237. #endif
  238. #if __LDBL_HAS_QUIET_NAN__
  239. #undef LDBL_SNAN
  240. #define LDBL_SNAN (__builtin_nansl (""))
  241. #endif
  242. #endif /* C2X */
  243. #if (defined __STDC_WANT_IEC_60559_BFP_EXT__ \
  244. || defined __STDC_WANT_IEC_60559_EXT__)
  245. /* Number of decimal digits for which conversions between decimal
  246. character strings and binary formats, in both directions, are
  247. correctly rounded. */
  248. #define CR_DECIMAL_DIG __UINTMAX_MAX__
  249. #endif
  250. #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
  251. /* Constants for _FloatN and _FloatNx types from TS 18661-3. See
  252. comments above for their semantics. */
  253. #ifdef __FLT16_MANT_DIG__
  254. #undef FLT16_MANT_DIG
  255. #define FLT16_MANT_DIG __FLT16_MANT_DIG__
  256. #undef FLT16_DIG
  257. #define FLT16_DIG __FLT16_DIG__
  258. #undef FLT16_MIN_EXP
  259. #define FLT16_MIN_EXP __FLT16_MIN_EXP__
  260. #undef FLT16_MIN_10_EXP
  261. #define FLT16_MIN_10_EXP __FLT16_MIN_10_EXP__
  262. #undef FLT16_MAX_EXP
  263. #define FLT16_MAX_EXP __FLT16_MAX_EXP__
  264. #undef FLT16_MAX_10_EXP
  265. #define FLT16_MAX_10_EXP __FLT16_MAX_10_EXP__
  266. #undef FLT16_MAX
  267. #define FLT16_MAX __FLT16_MAX__
  268. #undef FLT16_EPSILON
  269. #define FLT16_EPSILON __FLT16_EPSILON__
  270. #undef FLT16_MIN
  271. #define FLT16_MIN __FLT16_MIN__
  272. #undef FLT16_DECIMAL_DIG
  273. #define FLT16_DECIMAL_DIG __FLT16_DECIMAL_DIG__
  274. #undef FLT16_TRUE_MIN
  275. #define FLT16_TRUE_MIN __FLT16_DENORM_MIN__
  276. #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
  277. #undef FLT16_SNAN
  278. #define FLT16_SNAN (__builtin_nansf16 (""))
  279. #endif /* C2X */
  280. #endif /* __FLT16_MANT_DIG__. */
  281. #ifdef __FLT32_MANT_DIG__
  282. #undef FLT32_MANT_DIG
  283. #define FLT32_MANT_DIG __FLT32_MANT_DIG__
  284. #undef FLT32_DIG
  285. #define FLT32_DIG __FLT32_DIG__
  286. #undef FLT32_MIN_EXP
  287. #define FLT32_MIN_EXP __FLT32_MIN_EXP__
  288. #undef FLT32_MIN_10_EXP
  289. #define FLT32_MIN_10_EXP __FLT32_MIN_10_EXP__
  290. #undef FLT32_MAX_EXP
  291. #define FLT32_MAX_EXP __FLT32_MAX_EXP__
  292. #undef FLT32_MAX_10_EXP
  293. #define FLT32_MAX_10_EXP __FLT32_MAX_10_EXP__
  294. #undef FLT32_MAX
  295. #define FLT32_MAX __FLT32_MAX__
  296. #undef FLT32_EPSILON
  297. #define FLT32_EPSILON __FLT32_EPSILON__
  298. #undef FLT32_MIN
  299. #define FLT32_MIN __FLT32_MIN__
  300. #undef FLT32_DECIMAL_DIG
  301. #define FLT32_DECIMAL_DIG __FLT32_DECIMAL_DIG__
  302. #undef FLT32_TRUE_MIN
  303. #define FLT32_TRUE_MIN __FLT32_DENORM_MIN__
  304. #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
  305. #undef FLT32_SNAN
  306. #define FLT32_SNAN (__builtin_nansf32 (""))
  307. #endif /* C2X */
  308. #endif /* __FLT32_MANT_DIG__. */
  309. #ifdef __FLT64_MANT_DIG__
  310. #undef FLT64_MANT_DIG
  311. #define FLT64_MANT_DIG __FLT64_MANT_DIG__
  312. #undef FLT64_DIG
  313. #define FLT64_DIG __FLT64_DIG__
  314. #undef FLT64_MIN_EXP
  315. #define FLT64_MIN_EXP __FLT64_MIN_EXP__
  316. #undef FLT64_MIN_10_EXP
  317. #define FLT64_MIN_10_EXP __FLT64_MIN_10_EXP__
  318. #undef FLT64_MAX_EXP
  319. #define FLT64_MAX_EXP __FLT64_MAX_EXP__
  320. #undef FLT64_MAX_10_EXP
  321. #define FLT64_MAX_10_EXP __FLT64_MAX_10_EXP__
  322. #undef FLT64_MAX
  323. #define FLT64_MAX __FLT64_MAX__
  324. #undef FLT64_EPSILON
  325. #define FLT64_EPSILON __FLT64_EPSILON__
  326. #undef FLT64_MIN
  327. #define FLT64_MIN __FLT64_MIN__
  328. #undef FLT64_DECIMAL_DIG
  329. #define FLT64_DECIMAL_DIG __FLT64_DECIMAL_DIG__
  330. #undef FLT64_TRUE_MIN
  331. #define FLT64_TRUE_MIN __FLT64_DENORM_MIN__
  332. #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
  333. #undef FLT64_SNAN
  334. #define FLT64_SNAN (__builtin_nansf64 (""))
  335. #endif /* C2X */
  336. #endif /* __FLT64_MANT_DIG__. */
  337. #ifdef __FLT128_MANT_DIG__
  338. #undef FLT128_MANT_DIG
  339. #define FLT128_MANT_DIG __FLT128_MANT_DIG__
  340. #undef FLT128_DIG
  341. #define FLT128_DIG __FLT128_DIG__
  342. #undef FLT128_MIN_EXP
  343. #define FLT128_MIN_EXP __FLT128_MIN_EXP__
  344. #undef FLT128_MIN_10_EXP
  345. #define FLT128_MIN_10_EXP __FLT128_MIN_10_EXP__
  346. #undef FLT128_MAX_EXP
  347. #define FLT128_MAX_EXP __FLT128_MAX_EXP__
  348. #undef FLT128_MAX_10_EXP
  349. #define FLT128_MAX_10_EXP __FLT128_MAX_10_EXP__
  350. #undef FLT128_MAX
  351. #define FLT128_MAX __FLT128_MAX__
  352. #undef FLT128_EPSILON
  353. #define FLT128_EPSILON __FLT128_EPSILON__
  354. #undef FLT128_MIN
  355. #define FLT128_MIN __FLT128_MIN__
  356. #undef FLT128_DECIMAL_DIG
  357. #define FLT128_DECIMAL_DIG __FLT128_DECIMAL_DIG__
  358. #undef FLT128_TRUE_MIN
  359. #define FLT128_TRUE_MIN __FLT128_DENORM_MIN__
  360. #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
  361. #undef FLT128_SNAN
  362. #define FLT128_SNAN (__builtin_nansf128 (""))
  363. #endif /* C2X */
  364. #endif /* __FLT128_MANT_DIG__. */
  365. #ifdef __FLT32X_MANT_DIG__
  366. #undef FLT32X_MANT_DIG
  367. #define FLT32X_MANT_DIG __FLT32X_MANT_DIG__
  368. #undef FLT32X_DIG
  369. #define FLT32X_DIG __FLT32X_DIG__
  370. #undef FLT32X_MIN_EXP
  371. #define FLT32X_MIN_EXP __FLT32X_MIN_EXP__
  372. #undef FLT32X_MIN_10_EXP
  373. #define FLT32X_MIN_10_EXP __FLT32X_MIN_10_EXP__
  374. #undef FLT32X_MAX_EXP
  375. #define FLT32X_MAX_EXP __FLT32X_MAX_EXP__
  376. #undef FLT32X_MAX_10_EXP
  377. #define FLT32X_MAX_10_EXP __FLT32X_MAX_10_EXP__
  378. #undef FLT32X_MAX
  379. #define FLT32X_MAX __FLT32X_MAX__
  380. #undef FLT32X_EPSILON
  381. #define FLT32X_EPSILON __FLT32X_EPSILON__
  382. #undef FLT32X_MIN
  383. #define FLT32X_MIN __FLT32X_MIN__
  384. #undef FLT32X_DECIMAL_DIG
  385. #define FLT32X_DECIMAL_DIG __FLT32X_DECIMAL_DIG__
  386. #undef FLT32X_TRUE_MIN
  387. #define FLT32X_TRUE_MIN __FLT32X_DENORM_MIN__
  388. #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
  389. #undef FLT32X_SNAN
  390. #define FLT32X_SNAN (__builtin_nansf32x (""))
  391. #endif /* C2X */
  392. #endif /* __FLT32X_MANT_DIG__. */
  393. #ifdef __FLT64X_MANT_DIG__
  394. #undef FLT64X_MANT_DIG
  395. #define FLT64X_MANT_DIG __FLT64X_MANT_DIG__
  396. #undef FLT64X_DIG
  397. #define FLT64X_DIG __FLT64X_DIG__
  398. #undef FLT64X_MIN_EXP
  399. #define FLT64X_MIN_EXP __FLT64X_MIN_EXP__
  400. #undef FLT64X_MIN_10_EXP
  401. #define FLT64X_MIN_10_EXP __FLT64X_MIN_10_EXP__
  402. #undef FLT64X_MAX_EXP
  403. #define FLT64X_MAX_EXP __FLT64X_MAX_EXP__
  404. #undef FLT64X_MAX_10_EXP
  405. #define FLT64X_MAX_10_EXP __FLT64X_MAX_10_EXP__
  406. #undef FLT64X_MAX
  407. #define FLT64X_MAX __FLT64X_MAX__
  408. #undef FLT64X_EPSILON
  409. #define FLT64X_EPSILON __FLT64X_EPSILON__
  410. #undef FLT64X_MIN
  411. #define FLT64X_MIN __FLT64X_MIN__
  412. #undef FLT64X_DECIMAL_DIG
  413. #define FLT64X_DECIMAL_DIG __FLT64X_DECIMAL_DIG__
  414. #undef FLT64X_TRUE_MIN
  415. #define FLT64X_TRUE_MIN __FLT64X_DENORM_MIN__
  416. #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
  417. #undef FLT64X_SNAN
  418. #define FLT64X_SNAN (__builtin_nansf64x (""))
  419. #endif /* C2X */
  420. #endif /* __FLT64X_MANT_DIG__. */
  421. #ifdef __FLT128X_MANT_DIG__
  422. #undef FLT128X_MANT_DIG
  423. #define FLT128X_MANT_DIG __FLT128X_MANT_DIG__
  424. #undef FLT128X_DIG
  425. #define FLT128X_DIG __FLT128X_DIG__
  426. #undef FLT128X_MIN_EXP
  427. #define FLT128X_MIN_EXP __FLT128X_MIN_EXP__
  428. #undef FLT128X_MIN_10_EXP
  429. #define FLT128X_MIN_10_EXP __FLT128X_MIN_10_EXP__
  430. #undef FLT128X_MAX_EXP
  431. #define FLT128X_MAX_EXP __FLT128X_MAX_EXP__
  432. #undef FLT128X_MAX_10_EXP
  433. #define FLT128X_MAX_10_EXP __FLT128X_MAX_10_EXP__
  434. #undef FLT128X_MAX
  435. #define FLT128X_MAX __FLT128X_MAX__
  436. #undef FLT128X_EPSILON
  437. #define FLT128X_EPSILON __FLT128X_EPSILON__
  438. #undef FLT128X_MIN
  439. #define FLT128X_MIN __FLT128X_MIN__
  440. #undef FLT128X_DECIMAL_DIG
  441. #define FLT128X_DECIMAL_DIG __FLT128X_DECIMAL_DIG__
  442. #undef FLT128X_TRUE_MIN
  443. #define FLT128X_TRUE_MIN __FLT128X_DENORM_MIN__
  444. #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
  445. #undef FLT128X_SNAN
  446. #define FLT128X_SNAN (__builtin_nansf128x (""))
  447. #endif /* C2X */
  448. #endif /* __FLT128X_MANT_DIG__. */
  449. #endif /* __STDC_WANT_IEC_60559_TYPES_EXT__. */
  450. #ifdef __DEC32_MANT_DIG__
  451. #if (defined __STDC_WANT_DEC_FP__ \
  452. || defined __STDC_WANT_IEC_60559_DFP_EXT__ \
  453. || (defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L))
  454. /* C2X; formerly Technical Report 24732, extension for decimal
  455. floating-point arithmetic: Characteristic of decimal floating types
  456. <float.h>, and TS 18661-2. */
  457. /* Number of base-FLT_RADIX digits in the significand, p. */
  458. #undef DEC32_MANT_DIG
  459. #undef DEC64_MANT_DIG
  460. #undef DEC128_MANT_DIG
  461. #define DEC32_MANT_DIG __DEC32_MANT_DIG__
  462. #define DEC64_MANT_DIG __DEC64_MANT_DIG__
  463. #define DEC128_MANT_DIG __DEC128_MANT_DIG__
  464. /* Minimum exponent. */
  465. #undef DEC32_MIN_EXP
  466. #undef DEC64_MIN_EXP
  467. #undef DEC128_MIN_EXP
  468. #define DEC32_MIN_EXP __DEC32_MIN_EXP__
  469. #define DEC64_MIN_EXP __DEC64_MIN_EXP__
  470. #define DEC128_MIN_EXP __DEC128_MIN_EXP__
  471. /* Maximum exponent. */
  472. #undef DEC32_MAX_EXP
  473. #undef DEC64_MAX_EXP
  474. #undef DEC128_MAX_EXP
  475. #define DEC32_MAX_EXP __DEC32_MAX_EXP__
  476. #define DEC64_MAX_EXP __DEC64_MAX_EXP__
  477. #define DEC128_MAX_EXP __DEC128_MAX_EXP__
  478. /* Maximum representable finite decimal floating-point number
  479. (there are 6, 15, and 33 9s after the decimal points respectively). */
  480. #undef DEC32_MAX
  481. #undef DEC64_MAX
  482. #undef DEC128_MAX
  483. #define DEC32_MAX __DEC32_MAX__
  484. #define DEC64_MAX __DEC64_MAX__
  485. #define DEC128_MAX __DEC128_MAX__
  486. /* The difference between 1 and the least value greater than 1 that is
  487. representable in the given floating point type. */
  488. #undef DEC32_EPSILON
  489. #undef DEC64_EPSILON
  490. #undef DEC128_EPSILON
  491. #define DEC32_EPSILON __DEC32_EPSILON__
  492. #define DEC64_EPSILON __DEC64_EPSILON__
  493. #define DEC128_EPSILON __DEC128_EPSILON__
  494. /* Minimum normalized positive floating-point number. */
  495. #undef DEC32_MIN
  496. #undef DEC64_MIN
  497. #undef DEC128_MIN
  498. #define DEC32_MIN __DEC32_MIN__
  499. #define DEC64_MIN __DEC64_MIN__
  500. #define DEC128_MIN __DEC128_MIN__
  501. /* The floating-point expression evaluation method.
  502. -1 indeterminate
  503. 0 evaluate all operations and constants just to the range and
  504. precision of the type
  505. 1 evaluate operations and constants of type _Decimal32
  506. and _Decimal64 to the range and precision of the _Decimal64
  507. type, evaluate _Decimal128 operations and constants to the
  508. range and precision of the _Decimal128 type;
  509. 2 evaluate all operations and constants to the range and
  510. precision of the _Decimal128 type. */
  511. #undef DEC_EVAL_METHOD
  512. #define DEC_EVAL_METHOD __DEC_EVAL_METHOD__
  513. #endif /* __STDC_WANT_DEC_FP__ || __STDC_WANT_IEC_60559_DFP_EXT__ || C2X. */
  514. #ifdef __STDC_WANT_DEC_FP__
  515. /* Minimum subnormal positive floating-point number. */
  516. #undef DEC32_SUBNORMAL_MIN
  517. #undef DEC64_SUBNORMAL_MIN
  518. #undef DEC128_SUBNORMAL_MIN
  519. #define DEC32_SUBNORMAL_MIN __DEC32_SUBNORMAL_MIN__
  520. #define DEC64_SUBNORMAL_MIN __DEC64_SUBNORMAL_MIN__
  521. #define DEC128_SUBNORMAL_MIN __DEC128_SUBNORMAL_MIN__
  522. #endif /* __STDC_WANT_DEC_FP__. */
  523. #if (defined __STDC_WANT_IEC_60559_DFP_EXT__ \
  524. || (defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L))
  525. /* Minimum subnormal positive floating-point number. */
  526. #undef DEC32_TRUE_MIN
  527. #undef DEC64_TRUE_MIN
  528. #undef DEC128_TRUE_MIN
  529. #define DEC32_TRUE_MIN __DEC32_SUBNORMAL_MIN__
  530. #define DEC64_TRUE_MIN __DEC64_SUBNORMAL_MIN__
  531. #define DEC128_TRUE_MIN __DEC128_SUBNORMAL_MIN__
  532. #endif /* __STDC_WANT_IEC_60559_DFP_EXT__ || C2X. */
  533. #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
  534. /* Infinity in type _Decimal32. */
  535. #undef DEC_INFINITY
  536. #define DEC_INFINITY (__builtin_infd32 ())
  537. /* Quiet NaN in type _Decimal32. */
  538. #undef DEC_NAN
  539. #define DEC_NAN (__builtin_nand32 (""))
  540. /* Signaling NaN in each decimal floating-point type. */
  541. #undef DEC32_SNAN
  542. #define DEC32_SNAN (__builtin_nansd32 (""))
  543. #undef DEC64_SNAN
  544. #define DEC64_SNAN (__builtin_nansd64 (""))
  545. #undef DEC128_SNAN
  546. #define DEC128_SNAN (__builtin_nansd128 (""))
  547. #endif /* C2X */
  548. #endif /* __DEC32_MANT_DIG__ */
  549. #endif /* _FLOAT_H___ */
  550. #include_next <float.h>