1*bed243d3SAndroid Build Coastguard Worker /*===---- float.h - Characteristics of floating point types ----------------=== 2*bed243d3SAndroid Build Coastguard Worker * 3*bed243d3SAndroid Build Coastguard Worker * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*bed243d3SAndroid Build Coastguard Worker * See https://llvm.org/LICENSE.txt for license information. 5*bed243d3SAndroid Build Coastguard Worker * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*bed243d3SAndroid Build Coastguard Worker * 7*bed243d3SAndroid Build Coastguard Worker *===-----------------------------------------------------------------------=== 8*bed243d3SAndroid Build Coastguard Worker */ 9*bed243d3SAndroid Build Coastguard Worker 10*bed243d3SAndroid Build Coastguard Worker #ifndef __CLANG_FLOAT_H 11*bed243d3SAndroid Build Coastguard Worker #define __CLANG_FLOAT_H 12*bed243d3SAndroid Build Coastguard Worker 13*bed243d3SAndroid Build Coastguard Worker /* If we're on MinGW, fall back to the system's float.h, which might have 14*bed243d3SAndroid Build Coastguard Worker * additional definitions provided for Windows. 15*bed243d3SAndroid Build Coastguard Worker * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx 16*bed243d3SAndroid Build Coastguard Worker * 17*bed243d3SAndroid Build Coastguard Worker * Also fall back on Darwin and AIX to allow additional definitions and 18*bed243d3SAndroid Build Coastguard Worker * implementation-defined values. 19*bed243d3SAndroid Build Coastguard Worker */ 20*bed243d3SAndroid Build Coastguard Worker #if (defined(__APPLE__) || defined(__MINGW32__) || defined(_MSC_VER) || \ 21*bed243d3SAndroid Build Coastguard Worker defined(_AIX)) && \ 22*bed243d3SAndroid Build Coastguard Worker __STDC_HOSTED__ && __has_include_next(<float.h>) 23*bed243d3SAndroid Build Coastguard Worker 24*bed243d3SAndroid Build Coastguard Worker /* Prior to Apple's 10.7 SDK, float.h SDK header used to apply an extra level 25*bed243d3SAndroid Build Coastguard Worker * of #include_next<float.h> to keep Metrowerks compilers happy. Avoid this 26*bed243d3SAndroid Build Coastguard Worker * extra indirection. 27*bed243d3SAndroid Build Coastguard Worker */ 28*bed243d3SAndroid Build Coastguard Worker #ifdef __APPLE__ 29*bed243d3SAndroid Build Coastguard Worker #define _FLOAT_H_ 30*bed243d3SAndroid Build Coastguard Worker #endif 31*bed243d3SAndroid Build Coastguard Worker 32*bed243d3SAndroid Build Coastguard Worker # include_next <float.h> 33*bed243d3SAndroid Build Coastguard Worker 34*bed243d3SAndroid Build Coastguard Worker /* Undefine anything that we'll be redefining below. */ 35*bed243d3SAndroid Build Coastguard Worker # undef FLT_EVAL_METHOD 36*bed243d3SAndroid Build Coastguard Worker # undef FLT_ROUNDS 37*bed243d3SAndroid Build Coastguard Worker # undef FLT_RADIX 38*bed243d3SAndroid Build Coastguard Worker # undef FLT_MANT_DIG 39*bed243d3SAndroid Build Coastguard Worker # undef DBL_MANT_DIG 40*bed243d3SAndroid Build Coastguard Worker # undef LDBL_MANT_DIG 41*bed243d3SAndroid Build Coastguard Worker #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ 42*bed243d3SAndroid Build Coastguard Worker !defined(__STRICT_ANSI__) || \ 43*bed243d3SAndroid Build Coastguard Worker (defined(__cplusplus) && __cplusplus >= 201103L) || \ 44*bed243d3SAndroid Build Coastguard Worker (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE)) 45*bed243d3SAndroid Build Coastguard Worker # undef DECIMAL_DIG 46*bed243d3SAndroid Build Coastguard Worker # endif 47*bed243d3SAndroid Build Coastguard Worker # undef FLT_DIG 48*bed243d3SAndroid Build Coastguard Worker # undef DBL_DIG 49*bed243d3SAndroid Build Coastguard Worker # undef LDBL_DIG 50*bed243d3SAndroid Build Coastguard Worker # undef FLT_MIN_EXP 51*bed243d3SAndroid Build Coastguard Worker # undef DBL_MIN_EXP 52*bed243d3SAndroid Build Coastguard Worker # undef LDBL_MIN_EXP 53*bed243d3SAndroid Build Coastguard Worker # undef FLT_MIN_10_EXP 54*bed243d3SAndroid Build Coastguard Worker # undef DBL_MIN_10_EXP 55*bed243d3SAndroid Build Coastguard Worker # undef LDBL_MIN_10_EXP 56*bed243d3SAndroid Build Coastguard Worker # undef FLT_MAX_EXP 57*bed243d3SAndroid Build Coastguard Worker # undef DBL_MAX_EXP 58*bed243d3SAndroid Build Coastguard Worker # undef LDBL_MAX_EXP 59*bed243d3SAndroid Build Coastguard Worker # undef FLT_MAX_10_EXP 60*bed243d3SAndroid Build Coastguard Worker # undef DBL_MAX_10_EXP 61*bed243d3SAndroid Build Coastguard Worker # undef LDBL_MAX_10_EXP 62*bed243d3SAndroid Build Coastguard Worker # undef FLT_MAX 63*bed243d3SAndroid Build Coastguard Worker # undef DBL_MAX 64*bed243d3SAndroid Build Coastguard Worker # undef LDBL_MAX 65*bed243d3SAndroid Build Coastguard Worker # undef FLT_EPSILON 66*bed243d3SAndroid Build Coastguard Worker # undef DBL_EPSILON 67*bed243d3SAndroid Build Coastguard Worker # undef LDBL_EPSILON 68*bed243d3SAndroid Build Coastguard Worker # undef FLT_MIN 69*bed243d3SAndroid Build Coastguard Worker # undef DBL_MIN 70*bed243d3SAndroid Build Coastguard Worker # undef LDBL_MIN 71*bed243d3SAndroid Build Coastguard Worker #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ 72*bed243d3SAndroid Build Coastguard Worker !defined(__STRICT_ANSI__) || \ 73*bed243d3SAndroid Build Coastguard Worker (defined(__cplusplus) && __cplusplus >= 201703L) || \ 74*bed243d3SAndroid Build Coastguard Worker (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE)) 75*bed243d3SAndroid Build Coastguard Worker # undef FLT_TRUE_MIN 76*bed243d3SAndroid Build Coastguard Worker # undef DBL_TRUE_MIN 77*bed243d3SAndroid Build Coastguard Worker # undef LDBL_TRUE_MIN 78*bed243d3SAndroid Build Coastguard Worker # undef FLT_DECIMAL_DIG 79*bed243d3SAndroid Build Coastguard Worker # undef DBL_DECIMAL_DIG 80*bed243d3SAndroid Build Coastguard Worker # undef LDBL_DECIMAL_DIG 81*bed243d3SAndroid Build Coastguard Worker # undef FLT_HAS_SUBNORM 82*bed243d3SAndroid Build Coastguard Worker # undef DBL_HAS_SUBNORM 83*bed243d3SAndroid Build Coastguard Worker # undef LDBL_HAS_SUBNORM 84*bed243d3SAndroid Build Coastguard Worker # endif 85*bed243d3SAndroid Build Coastguard Worker #endif 86*bed243d3SAndroid Build Coastguard Worker 87*bed243d3SAndroid Build Coastguard Worker /* Characteristics of floating point types, C99 5.2.4.2.2 */ 88*bed243d3SAndroid Build Coastguard Worker 89*bed243d3SAndroid Build Coastguard Worker #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ 90*bed243d3SAndroid Build Coastguard Worker (defined(__cplusplus) && __cplusplus >= 201103L) 91*bed243d3SAndroid Build Coastguard Worker #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ 92*bed243d3SAndroid Build Coastguard Worker #endif 93*bed243d3SAndroid Build Coastguard Worker #define FLT_ROUNDS (__builtin_flt_rounds()) 94*bed243d3SAndroid Build Coastguard Worker #define FLT_RADIX __FLT_RADIX__ 95*bed243d3SAndroid Build Coastguard Worker 96*bed243d3SAndroid Build Coastguard Worker #define FLT_MANT_DIG __FLT_MANT_DIG__ 97*bed243d3SAndroid Build Coastguard Worker #define DBL_MANT_DIG __DBL_MANT_DIG__ 98*bed243d3SAndroid Build Coastguard Worker #define LDBL_MANT_DIG __LDBL_MANT_DIG__ 99*bed243d3SAndroid Build Coastguard Worker 100*bed243d3SAndroid Build Coastguard Worker #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ 101*bed243d3SAndroid Build Coastguard Worker !defined(__STRICT_ANSI__) || \ 102*bed243d3SAndroid Build Coastguard Worker (defined(__cplusplus) && __cplusplus >= 201103L) || \ 103*bed243d3SAndroid Build Coastguard Worker (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE)) 104*bed243d3SAndroid Build Coastguard Worker # define DECIMAL_DIG __DECIMAL_DIG__ 105*bed243d3SAndroid Build Coastguard Worker #endif 106*bed243d3SAndroid Build Coastguard Worker 107*bed243d3SAndroid Build Coastguard Worker #define FLT_DIG __FLT_DIG__ 108*bed243d3SAndroid Build Coastguard Worker #define DBL_DIG __DBL_DIG__ 109*bed243d3SAndroid Build Coastguard Worker #define LDBL_DIG __LDBL_DIG__ 110*bed243d3SAndroid Build Coastguard Worker 111*bed243d3SAndroid Build Coastguard Worker #define FLT_MIN_EXP __FLT_MIN_EXP__ 112*bed243d3SAndroid Build Coastguard Worker #define DBL_MIN_EXP __DBL_MIN_EXP__ 113*bed243d3SAndroid Build Coastguard Worker #define LDBL_MIN_EXP __LDBL_MIN_EXP__ 114*bed243d3SAndroid Build Coastguard Worker 115*bed243d3SAndroid Build Coastguard Worker #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ 116*bed243d3SAndroid Build Coastguard Worker #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ 117*bed243d3SAndroid Build Coastguard Worker #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ 118*bed243d3SAndroid Build Coastguard Worker 119*bed243d3SAndroid Build Coastguard Worker #define FLT_MAX_EXP __FLT_MAX_EXP__ 120*bed243d3SAndroid Build Coastguard Worker #define DBL_MAX_EXP __DBL_MAX_EXP__ 121*bed243d3SAndroid Build Coastguard Worker #define LDBL_MAX_EXP __LDBL_MAX_EXP__ 122*bed243d3SAndroid Build Coastguard Worker 123*bed243d3SAndroid Build Coastguard Worker #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ 124*bed243d3SAndroid Build Coastguard Worker #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ 125*bed243d3SAndroid Build Coastguard Worker #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ 126*bed243d3SAndroid Build Coastguard Worker 127*bed243d3SAndroid Build Coastguard Worker #define FLT_MAX __FLT_MAX__ 128*bed243d3SAndroid Build Coastguard Worker #define DBL_MAX __DBL_MAX__ 129*bed243d3SAndroid Build Coastguard Worker #define LDBL_MAX __LDBL_MAX__ 130*bed243d3SAndroid Build Coastguard Worker 131*bed243d3SAndroid Build Coastguard Worker #define FLT_EPSILON __FLT_EPSILON__ 132*bed243d3SAndroid Build Coastguard Worker #define DBL_EPSILON __DBL_EPSILON__ 133*bed243d3SAndroid Build Coastguard Worker #define LDBL_EPSILON __LDBL_EPSILON__ 134*bed243d3SAndroid Build Coastguard Worker 135*bed243d3SAndroid Build Coastguard Worker #define FLT_MIN __FLT_MIN__ 136*bed243d3SAndroid Build Coastguard Worker #define DBL_MIN __DBL_MIN__ 137*bed243d3SAndroid Build Coastguard Worker #define LDBL_MIN __LDBL_MIN__ 138*bed243d3SAndroid Build Coastguard Worker 139*bed243d3SAndroid Build Coastguard Worker #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ 140*bed243d3SAndroid Build Coastguard Worker !defined(__STRICT_ANSI__) || \ 141*bed243d3SAndroid Build Coastguard Worker (defined(__cplusplus) && __cplusplus >= 201703L) || \ 142*bed243d3SAndroid Build Coastguard Worker (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE)) 143*bed243d3SAndroid Build Coastguard Worker # define FLT_TRUE_MIN __FLT_DENORM_MIN__ 144*bed243d3SAndroid Build Coastguard Worker # define DBL_TRUE_MIN __DBL_DENORM_MIN__ 145*bed243d3SAndroid Build Coastguard Worker # define LDBL_TRUE_MIN __LDBL_DENORM_MIN__ 146*bed243d3SAndroid Build Coastguard Worker # define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__ 147*bed243d3SAndroid Build Coastguard Worker # define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__ 148*bed243d3SAndroid Build Coastguard Worker # define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__ 149*bed243d3SAndroid Build Coastguard Worker # define FLT_HAS_SUBNORM __FLT_HAS_DENORM__ 150*bed243d3SAndroid Build Coastguard Worker # define DBL_HAS_SUBNORM __DBL_HAS_DENORM__ 151*bed243d3SAndroid Build Coastguard Worker # define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__ 152*bed243d3SAndroid Build Coastguard Worker #endif 153*bed243d3SAndroid Build Coastguard Worker 154*bed243d3SAndroid Build Coastguard Worker #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__ 155*bed243d3SAndroid Build Coastguard Worker # define FLT16_MANT_DIG __FLT16_MANT_DIG__ 156*bed243d3SAndroid Build Coastguard Worker # define FLT16_DECIMAL_DIG __FLT16_DECIMAL_DIG__ 157*bed243d3SAndroid Build Coastguard Worker # define FLT16_DIG __FLT16_DIG__ 158*bed243d3SAndroid Build Coastguard Worker # define FLT16_MIN_EXP __FLT16_MIN_EXP__ 159*bed243d3SAndroid Build Coastguard Worker # define FLT16_MIN_10_EXP __FLT16_MIN_10_EXP__ 160*bed243d3SAndroid Build Coastguard Worker # define FLT16_MAX_EXP __FLT16_MAX_EXP__ 161*bed243d3SAndroid Build Coastguard Worker # define FLT16_MAX_10_EXP __FLT16_MAX_10_EXP__ 162*bed243d3SAndroid Build Coastguard Worker # define FLT16_MAX __FLT16_MAX__ 163*bed243d3SAndroid Build Coastguard Worker # define FLT16_EPSILON __FLT16_EPSILON__ 164*bed243d3SAndroid Build Coastguard Worker # define FLT16_MIN __FLT16_MIN__ 165*bed243d3SAndroid Build Coastguard Worker # define FLT16_TRUE_MIN __FLT16_TRUE_MIN__ 166*bed243d3SAndroid Build Coastguard Worker #endif /* __STDC_WANT_IEC_60559_TYPES_EXT__ */ 167*bed243d3SAndroid Build Coastguard Worker 168*bed243d3SAndroid Build Coastguard Worker #endif /* __CLANG_FLOAT_H */ 169