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