1*f4a2713aSLionel Sambuc /*===---- float.h - Characteristics of floating point types ----------------=== 2*f4a2713aSLionel Sambuc * 3*f4a2713aSLionel Sambuc * Permission is hereby granted, free of charge, to any person obtaining a copy 4*f4a2713aSLionel Sambuc * of this software and associated documentation files (the "Software"), to deal 5*f4a2713aSLionel Sambuc * in the Software without restriction, including without limitation the rights 6*f4a2713aSLionel Sambuc * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7*f4a2713aSLionel Sambuc * copies of the Software, and to permit persons to whom the Software is 8*f4a2713aSLionel Sambuc * furnished to do so, subject to the following conditions: 9*f4a2713aSLionel Sambuc * 10*f4a2713aSLionel Sambuc * The above copyright notice and this permission notice shall be included in 11*f4a2713aSLionel Sambuc * all copies or substantial portions of the Software. 12*f4a2713aSLionel Sambuc * 13*f4a2713aSLionel Sambuc * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14*f4a2713aSLionel Sambuc * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15*f4a2713aSLionel Sambuc * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16*f4a2713aSLionel Sambuc * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17*f4a2713aSLionel Sambuc * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18*f4a2713aSLionel Sambuc * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19*f4a2713aSLionel Sambuc * THE SOFTWARE. 20*f4a2713aSLionel Sambuc * 21*f4a2713aSLionel Sambuc *===-----------------------------------------------------------------------=== 22*f4a2713aSLionel Sambuc */ 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambuc #ifndef __FLOAT_H 25*f4a2713aSLionel Sambuc #define __FLOAT_H 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc /* If we're on MinGW, fall back to the system's float.h, which might have 28*f4a2713aSLionel Sambuc * additional definitions provided for Windows. 29*f4a2713aSLionel Sambuc * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx 30*f4a2713aSLionel Sambuc */ 31*f4a2713aSLionel Sambuc #if (defined(__MINGW32__) || defined(_MSC_VER)) && \ 32*f4a2713aSLionel Sambuc defined(__has_include_next) && __has_include_next(<float.h>) 33*f4a2713aSLionel Sambuc # include_next <float.h> 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambuc /* Undefine anything that we'll be redefining below. */ 36*f4a2713aSLionel Sambuc # undef FLT_EVAL_METHOD 37*f4a2713aSLionel Sambuc # undef FLT_ROUNDS 38*f4a2713aSLionel Sambuc # undef FLT_RADIX 39*f4a2713aSLionel Sambuc # undef FLT_MANT_DIG 40*f4a2713aSLionel Sambuc # undef DBL_MANT_DIG 41*f4a2713aSLionel Sambuc # undef LDBL_MANT_DIG 42*f4a2713aSLionel Sambuc # undef DECIMAL_DIG 43*f4a2713aSLionel Sambuc # undef FLT_DIG 44*f4a2713aSLionel Sambuc # undef DBL_DIG 45*f4a2713aSLionel Sambuc # undef LDBL_DIG 46*f4a2713aSLionel Sambuc # undef FLT_MIN_EXP 47*f4a2713aSLionel Sambuc # undef DBL_MIN_EXP 48*f4a2713aSLionel Sambuc # undef LDBL_MIN_EXP 49*f4a2713aSLionel Sambuc # undef FLT_MIN_10_EXP 50*f4a2713aSLionel Sambuc # undef DBL_MIN_10_EXP 51*f4a2713aSLionel Sambuc # undef LDBL_MIN_10_EXP 52*f4a2713aSLionel Sambuc # undef FLT_MAX_EXP 53*f4a2713aSLionel Sambuc # undef DBL_MAX_EXP 54*f4a2713aSLionel Sambuc # undef LDBL_MAX_EXP 55*f4a2713aSLionel Sambuc # undef FLT_MAX_10_EXP 56*f4a2713aSLionel Sambuc # undef DBL_MAX_10_EXP 57*f4a2713aSLionel Sambuc # undef LDBL_MAX_10_EXP 58*f4a2713aSLionel Sambuc # undef FLT_MAX 59*f4a2713aSLionel Sambuc # undef DBL_MAX 60*f4a2713aSLionel Sambuc # undef LDBL_MAX 61*f4a2713aSLionel Sambuc # undef FLT_EPSILON 62*f4a2713aSLionel Sambuc # undef DBL_EPSILON 63*f4a2713aSLionel Sambuc # undef LDBL_EPSILON 64*f4a2713aSLionel Sambuc # undef FLT_MIN 65*f4a2713aSLionel Sambuc # undef DBL_MIN 66*f4a2713aSLionel Sambuc # undef LDBL_MIN 67*f4a2713aSLionel Sambuc # if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) 68*f4a2713aSLionel Sambuc # undef FLT_TRUE_MIN 69*f4a2713aSLionel Sambuc # undef DBL_TRUE_MIN 70*f4a2713aSLionel Sambuc # undef LDBL_TRUE_MIN 71*f4a2713aSLionel Sambuc # endif 72*f4a2713aSLionel Sambuc #endif 73*f4a2713aSLionel Sambuc 74*f4a2713aSLionel Sambuc /* Characteristics of floating point types, C99 5.2.4.2.2 */ 75*f4a2713aSLionel Sambuc 76*f4a2713aSLionel Sambuc #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ 77*f4a2713aSLionel Sambuc #define FLT_ROUNDS (__builtin_flt_rounds()) 78*f4a2713aSLionel Sambuc #define FLT_RADIX __FLT_RADIX__ 79*f4a2713aSLionel Sambuc 80*f4a2713aSLionel Sambuc #define FLT_MANT_DIG __FLT_MANT_DIG__ 81*f4a2713aSLionel Sambuc #define DBL_MANT_DIG __DBL_MANT_DIG__ 82*f4a2713aSLionel Sambuc #define LDBL_MANT_DIG __LDBL_MANT_DIG__ 83*f4a2713aSLionel Sambuc 84*f4a2713aSLionel Sambuc #define DECIMAL_DIG __DECIMAL_DIG__ 85*f4a2713aSLionel Sambuc 86*f4a2713aSLionel Sambuc #define FLT_DIG __FLT_DIG__ 87*f4a2713aSLionel Sambuc #define DBL_DIG __DBL_DIG__ 88*f4a2713aSLionel Sambuc #define LDBL_DIG __LDBL_DIG__ 89*f4a2713aSLionel Sambuc 90*f4a2713aSLionel Sambuc #define FLT_MIN_EXP __FLT_MIN_EXP__ 91*f4a2713aSLionel Sambuc #define DBL_MIN_EXP __DBL_MIN_EXP__ 92*f4a2713aSLionel Sambuc #define LDBL_MIN_EXP __LDBL_MIN_EXP__ 93*f4a2713aSLionel Sambuc 94*f4a2713aSLionel Sambuc #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ 95*f4a2713aSLionel Sambuc #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ 96*f4a2713aSLionel Sambuc #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ 97*f4a2713aSLionel Sambuc 98*f4a2713aSLionel Sambuc #define FLT_MAX_EXP __FLT_MAX_EXP__ 99*f4a2713aSLionel Sambuc #define DBL_MAX_EXP __DBL_MAX_EXP__ 100*f4a2713aSLionel Sambuc #define LDBL_MAX_EXP __LDBL_MAX_EXP__ 101*f4a2713aSLionel Sambuc 102*f4a2713aSLionel Sambuc #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ 103*f4a2713aSLionel Sambuc #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ 104*f4a2713aSLionel Sambuc #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ 105*f4a2713aSLionel Sambuc 106*f4a2713aSLionel Sambuc #define FLT_MAX __FLT_MAX__ 107*f4a2713aSLionel Sambuc #define DBL_MAX __DBL_MAX__ 108*f4a2713aSLionel Sambuc #define LDBL_MAX __LDBL_MAX__ 109*f4a2713aSLionel Sambuc 110*f4a2713aSLionel Sambuc #define FLT_EPSILON __FLT_EPSILON__ 111*f4a2713aSLionel Sambuc #define DBL_EPSILON __DBL_EPSILON__ 112*f4a2713aSLionel Sambuc #define LDBL_EPSILON __LDBL_EPSILON__ 113*f4a2713aSLionel Sambuc 114*f4a2713aSLionel Sambuc #define FLT_MIN __FLT_MIN__ 115*f4a2713aSLionel Sambuc #define DBL_MIN __DBL_MIN__ 116*f4a2713aSLionel Sambuc #define LDBL_MIN __LDBL_MIN__ 117*f4a2713aSLionel Sambuc 118*f4a2713aSLionel Sambuc #if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) 119*f4a2713aSLionel Sambuc # define FLT_TRUE_MIN __FLT_DENORM_MIN__ 120*f4a2713aSLionel Sambuc # define DBL_TRUE_MIN __DBL_DENORM_MIN__ 121*f4a2713aSLionel Sambuc # define LDBL_TRUE_MIN __LDBL_DENORM_MIN__ 122*f4a2713aSLionel Sambuc #endif 123*f4a2713aSLionel Sambuc 124*f4a2713aSLionel Sambuc #endif /* __FLOAT_H */ 125