clang  8.0.0svn
float.h
Go to the documentation of this file.
1 /*===---- float.h - Characteristics of floating point types ----------------===
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to deal
5  * in the Software without restriction, including without limitation the rights
6  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7  * copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19  * THE SOFTWARE.
20  *
21  *===-----------------------------------------------------------------------===
22  */
23 
24 #ifndef __CLANG_FLOAT_H
25 #define __CLANG_FLOAT_H
26 
27 /* If we're on MinGW, fall back to the system's float.h, which might have
28  * additional definitions provided for Windows.
29  * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
30  *
31  * Also fall back on Darwin to allow additional definitions and
32  * implementation-defined values.
33  */
34 #if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
35  __STDC_HOSTED__ && __has_include_next(<float.h>)
36 
37 /* Prior to Apple's 10.7 SDK, float.h SDK header used to apply an extra level
38  * of #include_next<float.h> to keep Metrowerks compilers happy. Avoid this
39  * extra indirection.
40  */
41 #ifdef __APPLE__
42 #define _FLOAT_H_
43 #endif
44 
45 # include_next <float.h>
46 
47 /* Undefine anything that we'll be redefining below. */
48 # undef FLT_EVAL_METHOD
49 # undef FLT_ROUNDS
50 # undef FLT_RADIX
51 # undef FLT_MANT_DIG
52 # undef DBL_MANT_DIG
53 # undef LDBL_MANT_DIG
54 # if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__)
55 # undef DECIMAL_DIG
56 # endif
57 # undef FLT_DIG
58 # undef DBL_DIG
59 # undef LDBL_DIG
60 # undef FLT_MIN_EXP
61 # undef DBL_MIN_EXP
62 # undef LDBL_MIN_EXP
63 # undef FLT_MIN_10_EXP
64 # undef DBL_MIN_10_EXP
65 # undef LDBL_MIN_10_EXP
66 # undef FLT_MAX_EXP
67 # undef DBL_MAX_EXP
68 # undef LDBL_MAX_EXP
69 # undef FLT_MAX_10_EXP
70 # undef DBL_MAX_10_EXP
71 # undef LDBL_MAX_10_EXP
72 # undef FLT_MAX
73 # undef DBL_MAX
74 # undef LDBL_MAX
75 # undef FLT_EPSILON
76 # undef DBL_EPSILON
77 # undef LDBL_EPSILON
78 # undef FLT_MIN
79 # undef DBL_MIN
80 # undef LDBL_MIN
81 # if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
82 # undef FLT_TRUE_MIN
83 # undef DBL_TRUE_MIN
84 # undef LDBL_TRUE_MIN
85 # undef FLT_DECIMAL_DIG
86 # undef DBL_DECIMAL_DIG
87 # undef LDBL_DECIMAL_DIG
88 # undef FLT_HAS_SUBNORM
89 # undef DBL_HAS_SUBNORM
90 # undef LDBL_HAS_SUBNORM
91 # endif
92 #endif
93 
94 /* Characteristics of floating point types, C99 5.2.4.2.2 */
95 
96 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
97 #define FLT_ROUNDS (__builtin_flt_rounds())
98 #define FLT_RADIX __FLT_RADIX__
99 
100 #define FLT_MANT_DIG __FLT_MANT_DIG__
101 #define DBL_MANT_DIG __DBL_MANT_DIG__
102 #define LDBL_MANT_DIG __LDBL_MANT_DIG__
103 
104 #if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__)
105 # define DECIMAL_DIG __DECIMAL_DIG__
106 #endif
107 
108 #define FLT_DIG __FLT_DIG__
109 #define DBL_DIG __DBL_DIG__
110 #define LDBL_DIG __LDBL_DIG__
111 
112 #define FLT_MIN_EXP __FLT_MIN_EXP__
113 #define DBL_MIN_EXP __DBL_MIN_EXP__
114 #define LDBL_MIN_EXP __LDBL_MIN_EXP__
115 
116 #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
117 #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
118 #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
119 
120 #define FLT_MAX_EXP __FLT_MAX_EXP__
121 #define DBL_MAX_EXP __DBL_MAX_EXP__
122 #define LDBL_MAX_EXP __LDBL_MAX_EXP__
123 
124 #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
125 #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
126 #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
127 
128 #define FLT_MAX __FLT_MAX__
129 #define DBL_MAX __DBL_MAX__
130 #define LDBL_MAX __LDBL_MAX__
131 
132 #define FLT_EPSILON __FLT_EPSILON__
133 #define DBL_EPSILON __DBL_EPSILON__
134 #define LDBL_EPSILON __LDBL_EPSILON__
135 
136 #define FLT_MIN __FLT_MIN__
137 #define DBL_MIN __DBL_MIN__
138 #define LDBL_MIN __LDBL_MIN__
139 
140 #if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
141 # define FLT_TRUE_MIN __FLT_DENORM_MIN__
142 # define DBL_TRUE_MIN __DBL_DENORM_MIN__
143 # define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
144 # define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
145 # define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
146 # define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
147 # define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
148 # define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
149 # define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
150 #endif
151 
152 #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
153 # define FLT16_MANT_DIG __FLT16_MANT_DIG__
154 # define FLT16_DECIMAL_DIG __FLT16_DECIMAL_DIG__
155 # define FLT16_DIG __FLT16_DIG__
156 # define FLT16_MIN_EXP __FLT16_MIN_EXP__
157 # define FLT16_MIN_10_EXP __FLT16_MIN_10_EXP__
158 # define FLT16_MAX_EXP __FLT16_MAX_EXP__
159 # define FLT16_MAX_10_EXP __FLT16_MAX_10_EXP__
160 # define FLT16_MAX __FLT16_MAX__
161 # define FLT16_EPSILON __FLT16_EPSILON__
162 # define FLT16_MIN __FLT16_MIN__
163 # define FLT16_TRUE_MIN __FLT16_TRUE_MIN__
164 #endif /* __STDC_WANT_IEC_60559_TYPES_EXT__ */
165 
166 #endif /* __CLANG_FLOAT_H */