float.h revision 322320
1157602Srwatson/*===---- float.h - Characteristics of floating point types ----------------=== 2157602Srwatson * 3157602Srwatson * Permission is hereby granted, free of charge, to any person obtaining a copy 4157602Srwatson * of this software and associated documentation files (the "Software"), to deal 5157602Srwatson * in the Software without restriction, including without limitation the rights 6157602Srwatson * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7157602Srwatson * copies of the Software, and to permit persons to whom the Software is 8157602Srwatson * furnished to do so, subject to the following conditions: 9157602Srwatson * 10157602Srwatson * The above copyright notice and this permission notice shall be included in 11157602Srwatson * all copies or substantial portions of the Software. 12157602Srwatson * 13157602Srwatson * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14157602Srwatson * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15157602Srwatson * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16157602Srwatson * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17157602Srwatson * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18157602Srwatson * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19157602Srwatson * THE SOFTWARE. 20157602Srwatson * 21157602Srwatson *===-----------------------------------------------------------------------=== 22157602Srwatson */ 23157602Srwatson 24157602Srwatson#ifndef __FLOAT_H 25157602Srwatson#define __FLOAT_H 26157602Srwatson 27157602Srwatson/* If we're on MinGW, fall back to the system's float.h, which might have 28157602Srwatson * additional definitions provided for Windows. 29157602Srwatson * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx 30157602Srwatson * 31157602Srwatson * Also fall back on Darwin to allow additional definitions and 32157602Srwatson * implementation-defined values. 33157602Srwatson */ 34157602Srwatson#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \ 35157602Srwatson __STDC_HOSTED__ && __has_include_next(<float.h>) 36157602Srwatson 37157602Srwatson/* Prior to Apple's 10.7 SDK, float.h SDK header used to apply an extra level 38157602Srwatson * of #include_next<float.h> to keep Metrowerks compilers happy. Avoid this 39157602Srwatson * extra indirection. 40157602Srwatson */ 41157602Srwatson#ifdef __APPLE__ 42157602Srwatson#define _FLOAT_H_ 43281402Sngie#endif 44157602Srwatson 45157602Srwatson# include_next <float.h> 46157602Srwatson 47157602Srwatson/* Undefine anything that we'll be redefining below. */ 48157602Srwatson# undef FLT_EVAL_METHOD 49157602Srwatson# undef FLT_ROUNDS 50157602Srwatson# undef FLT_RADIX 51157602Srwatson# undef FLT_MANT_DIG 52157602Srwatson# undef DBL_MANT_DIG 53157602Srwatson# undef LDBL_MANT_DIG 54157602Srwatson# if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) 55157602Srwatson# undef DECIMAL_DIG 56157602Srwatson# endif 57157602Srwatson# undef FLT_DIG 58157602Srwatson# undef DBL_DIG 59157602Srwatson# undef LDBL_DIG 60157602Srwatson# undef FLT_MIN_EXP 61157602Srwatson# undef DBL_MIN_EXP 62294125Sngie# undef LDBL_MIN_EXP 63157602Srwatson# undef FLT_MIN_10_EXP 64157602Srwatson# undef DBL_MIN_10_EXP 65157602Srwatson# undef LDBL_MIN_10_EXP 66157602Srwatson# undef FLT_MAX_EXP 67157602Srwatson# undef DBL_MAX_EXP 68157602Srwatson# undef LDBL_MAX_EXP 69157602Srwatson# undef FLT_MAX_10_EXP 70157602Srwatson# undef DBL_MAX_10_EXP 71157602Srwatson# undef LDBL_MAX_10_EXP 72157602Srwatson# undef FLT_MAX 73157602Srwatson# undef DBL_MAX 74157602Srwatson# undef LDBL_MAX 75157602Srwatson# undef FLT_EPSILON 76157602Srwatson# undef DBL_EPSILON 77157602Srwatson# undef LDBL_EPSILON 78157602Srwatson# undef FLT_MIN 79157602Srwatson# undef DBL_MIN 80157602Srwatson# undef LDBL_MIN 81157602Srwatson# if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) 82157602Srwatson# undef FLT_TRUE_MIN 83157602Srwatson# undef DBL_TRUE_MIN 84157602Srwatson# undef LDBL_TRUE_MIN 85# undef FLT_DECIMAL_DIG 86# undef DBL_DECIMAL_DIG 87# undef LDBL_DECIMAL_DIG 88# endif 89#endif 90 91/* Characteristics of floating point types, C99 5.2.4.2.2 */ 92 93#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ 94#define FLT_ROUNDS (__builtin_flt_rounds()) 95#define FLT_RADIX __FLT_RADIX__ 96 97#define FLT_MANT_DIG __FLT_MANT_DIG__ 98#define DBL_MANT_DIG __DBL_MANT_DIG__ 99#define LDBL_MANT_DIG __LDBL_MANT_DIG__ 100 101#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) 102# define DECIMAL_DIG __DECIMAL_DIG__ 103#endif 104 105#define FLT_DIG __FLT_DIG__ 106#define DBL_DIG __DBL_DIG__ 107#define LDBL_DIG __LDBL_DIG__ 108 109#define FLT_MIN_EXP __FLT_MIN_EXP__ 110#define DBL_MIN_EXP __DBL_MIN_EXP__ 111#define LDBL_MIN_EXP __LDBL_MIN_EXP__ 112 113#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ 114#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ 115#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ 116 117#define FLT_MAX_EXP __FLT_MAX_EXP__ 118#define DBL_MAX_EXP __DBL_MAX_EXP__ 119#define LDBL_MAX_EXP __LDBL_MAX_EXP__ 120 121#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ 122#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ 123#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ 124 125#define FLT_MAX __FLT_MAX__ 126#define DBL_MAX __DBL_MAX__ 127#define LDBL_MAX __LDBL_MAX__ 128 129#define FLT_EPSILON __FLT_EPSILON__ 130#define DBL_EPSILON __DBL_EPSILON__ 131#define LDBL_EPSILON __LDBL_EPSILON__ 132 133#define FLT_MIN __FLT_MIN__ 134#define DBL_MIN __DBL_MIN__ 135#define LDBL_MIN __LDBL_MIN__ 136 137#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) 138# define FLT_TRUE_MIN __FLT_DENORM_MIN__ 139# define DBL_TRUE_MIN __DBL_DENORM_MIN__ 140# define LDBL_TRUE_MIN __LDBL_DENORM_MIN__ 141# define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__ 142# define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__ 143# define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__ 144#endif 145 146#endif /* __FLOAT_H */ 147