1 /*===---- float.h - Characteristics of floating point types ----------------===
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:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
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
21 *===-----------------------------------------------------------------------===
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
31 * Also fall back on Darwin to allow additional definitions and
32 * implementation-defined values.
34 #if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
35 __STDC_HOSTED__ && __has_include_next(<float.h>)
36 # include_next <float.h>
38 /* Undefine anything that we'll be redefining below. */
39 # undef FLT_EVAL_METHOD
45 # if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__)
54 # undef FLT_MIN_10_EXP
55 # undef DBL_MIN_10_EXP
56 # undef LDBL_MIN_10_EXP
60 # undef FLT_MAX_10_EXP
61 # undef DBL_MAX_10_EXP
62 # undef LDBL_MAX_10_EXP
72 # if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
76 # undef FLT_DECIMAL_DIG
77 # undef DBL_DECIMAL_DIG
78 # undef LDBL_DECIMAL_DIG
82 /* Characteristics of floating point types, C99 5.2.4.2.2 */
84 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
85 #define FLT_ROUNDS (__builtin_flt_rounds())
86 #define FLT_RADIX __FLT_RADIX__
88 #define FLT_MANT_DIG __FLT_MANT_DIG__
89 #define DBL_MANT_DIG __DBL_MANT_DIG__
90 #define LDBL_MANT_DIG __LDBL_MANT_DIG__
92 #if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__)
93 # define DECIMAL_DIG __DECIMAL_DIG__
96 #define FLT_DIG __FLT_DIG__
97 #define DBL_DIG __DBL_DIG__
98 #define LDBL_DIG __LDBL_DIG__
100 #define FLT_MIN_EXP __FLT_MIN_EXP__
101 #define DBL_MIN_EXP __DBL_MIN_EXP__
102 #define LDBL_MIN_EXP __LDBL_MIN_EXP__
104 #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
105 #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
106 #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
108 #define FLT_MAX_EXP __FLT_MAX_EXP__
109 #define DBL_MAX_EXP __DBL_MAX_EXP__
110 #define LDBL_MAX_EXP __LDBL_MAX_EXP__
112 #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
113 #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
114 #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
116 #define FLT_MAX __FLT_MAX__
117 #define DBL_MAX __DBL_MAX__
118 #define LDBL_MAX __LDBL_MAX__
120 #define FLT_EPSILON __FLT_EPSILON__
121 #define DBL_EPSILON __DBL_EPSILON__
122 #define LDBL_EPSILON __LDBL_EPSILON__
124 #define FLT_MIN __FLT_MIN__
125 #define DBL_MIN __DBL_MIN__
126 #define LDBL_MIN __LDBL_MIN__
128 #if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
129 # define FLT_TRUE_MIN __FLT_DENORM_MIN__
130 # define DBL_TRUE_MIN __DBL_DENORM_MIN__
131 # define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
132 # define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
133 # define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
134 # define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
137 #endif /* __FLOAT_H */