clang 22.0.0git
__float_float.h
Go to the documentation of this file.
1/*===---- __float_float.h --------------------------------------------------===
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 *===-----------------------------------------------------------------------===
8 */
9
10#ifndef __CLANG_FLOAT_FLOAT_H
11#define __CLANG_FLOAT_FLOAT_H
12
13#if (defined(__MINGW32__) || defined(_MSC_VER) || defined(_AIX)) && \
14 __STDC_HOSTED__
15
16/* Undefine anything that we'll be redefining below. */
17# undef FLT_EVAL_METHOD
18# undef FLT_ROUNDS
19# undef FLT_RADIX
20# undef FLT_MANT_DIG
21# undef DBL_MANT_DIG
22# undef LDBL_MANT_DIG
23#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
24 !defined(__STRICT_ANSI__) || \
25 (defined(__cplusplus) && __cplusplus >= 201103L) || \
26 (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
27# undef DECIMAL_DIG
28# endif
29# undef FLT_DIG
30# undef DBL_DIG
31# undef LDBL_DIG
32# undef FLT_MIN_EXP
33# undef DBL_MIN_EXP
34# undef LDBL_MIN_EXP
35# undef FLT_MIN_10_EXP
36# undef DBL_MIN_10_EXP
37# undef LDBL_MIN_10_EXP
38# undef FLT_MAX_EXP
39# undef DBL_MAX_EXP
40# undef LDBL_MAX_EXP
41# undef FLT_MAX_10_EXP
42# undef DBL_MAX_10_EXP
43# undef LDBL_MAX_10_EXP
44# undef FLT_MAX
45# undef DBL_MAX
46# undef LDBL_MAX
47# undef FLT_EPSILON
48# undef DBL_EPSILON
49# undef LDBL_EPSILON
50# undef FLT_MIN
51# undef DBL_MIN
52# undef LDBL_MIN
53#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
54 !defined(__STRICT_ANSI__) || \
55 (defined(__cplusplus) && __cplusplus >= 201703L) || \
56 (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
57# undef FLT_TRUE_MIN
58# undef DBL_TRUE_MIN
59# undef LDBL_TRUE_MIN
60# undef FLT_DECIMAL_DIG
61# undef DBL_DECIMAL_DIG
62# undef LDBL_DECIMAL_DIG
63# undef FLT_HAS_SUBNORM
64# undef DBL_HAS_SUBNORM
65# undef LDBL_HAS_SUBNORM
66# endif
67#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \
68 !defined(__STRICT_ANSI__)
69# undef FLT_NORM_MAX
70# undef DBL_NORM_MAX
71# undef LDBL_NORM_MAX
72#endif
73#endif
74
75#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \
76 !defined(__STRICT_ANSI__)
77# undef FLT_SNAN
78# undef DBL_SNAN
79# undef LDBL_SNAN
80#endif
81
82/* Characteristics of floating point types, C99 5.2.4.2.2 */
83
84#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
85 (defined(__cplusplus) && __cplusplus >= 201103L)
86#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
87#endif
88#define FLT_ROUNDS (__builtin_flt_rounds())
89#define FLT_RADIX __FLT_RADIX__
90
91#define FLT_MANT_DIG __FLT_MANT_DIG__
92#define DBL_MANT_DIG __DBL_MANT_DIG__
93#define LDBL_MANT_DIG __LDBL_MANT_DIG__
94
95#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
96 !defined(__STRICT_ANSI__) || \
97 (defined(__cplusplus) && __cplusplus >= 201103L) || \
98 (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
99# define DECIMAL_DIG __DECIMAL_DIG__
100#endif
101
102#define FLT_DIG __FLT_DIG__
103#define DBL_DIG __DBL_DIG__
104#define LDBL_DIG __LDBL_DIG__
105
106#define FLT_MIN_EXP __FLT_MIN_EXP__
107#define DBL_MIN_EXP __DBL_MIN_EXP__
108#define LDBL_MIN_EXP __LDBL_MIN_EXP__
109
110#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
111#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
112#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
113
114#define FLT_MAX_EXP __FLT_MAX_EXP__
115#define DBL_MAX_EXP __DBL_MAX_EXP__
116#define LDBL_MAX_EXP __LDBL_MAX_EXP__
117
118#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
119#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
120#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
121
122#define FLT_MAX __FLT_MAX__
123#define DBL_MAX __DBL_MAX__
124#define LDBL_MAX __LDBL_MAX__
125
126#define FLT_EPSILON __FLT_EPSILON__
127#define DBL_EPSILON __DBL_EPSILON__
128#define LDBL_EPSILON __LDBL_EPSILON__
129
130#define FLT_MIN __FLT_MIN__
131#define DBL_MIN __DBL_MIN__
132#define LDBL_MIN __LDBL_MIN__
133
134#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
135 !defined(__STRICT_ANSI__) || \
136 (defined(__cplusplus) && __cplusplus >= 201703L) || \
137 (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
138# define FLT_TRUE_MIN __FLT_DENORM_MIN__
139# define DBL_TRUE_MIN __DBL_DENORM_MIN__
140# define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
141# define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
142# define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
143# define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
144# define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
145# define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
146# define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
147#endif
148
149#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \
150 !defined(__STRICT_ANSI__)
151 /* C23 5.2.5.3.2p28 */
152# define FLT_SNAN (__builtin_nansf(""))
153# define DBL_SNAN (__builtin_nans(""))
154# define LDBL_SNAN (__builtin_nansl(""))
155
156 /* C23 5.2.5.3.3p32 */
157# define FLT_NORM_MAX __FLT_NORM_MAX__
158# define DBL_NORM_MAX __DBL_NORM_MAX__
159# define LDBL_NORM_MAX __LDBL_NORM_MAX__
160#endif
161
162#ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
163# define FLT16_MANT_DIG __FLT16_MANT_DIG__
164# define FLT16_DECIMAL_DIG __FLT16_DECIMAL_DIG__
165# define FLT16_DIG __FLT16_DIG__
166# define FLT16_MIN_EXP __FLT16_MIN_EXP__
167# define FLT16_MIN_10_EXP __FLT16_MIN_10_EXP__
168# define FLT16_MAX_EXP __FLT16_MAX_EXP__
169# define FLT16_MAX_10_EXP __FLT16_MAX_10_EXP__
170# define FLT16_MAX __FLT16_MAX__
171# define FLT16_EPSILON __FLT16_EPSILON__
172# define FLT16_MIN __FLT16_MIN__
173# define FLT16_TRUE_MIN __FLT16_TRUE_MIN__
174#endif /* __STDC_WANT_IEC_60559_TYPES_EXT__ */
175
176#endif /* __CLANG_FLOAT_FLOAT_H */