2008-12-27 01:10:18 +08:00
|
|
|
/*===---- float.h - Characteristics of floating point types ----------------===
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*
|
|
|
|
*===-----------------------------------------------------------------------===
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __FLOAT_H
|
|
|
|
#define __FLOAT_H
|
|
|
|
|
2011-07-19 16:48:08 +08:00
|
|
|
/* If we're on MinGW, fall back to the system's float.h, which might have
|
2011-07-05 22:17:04 +08:00
|
|
|
* additional definitions provided for Windows.
|
|
|
|
* For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
|
2016-12-08 10:13:56 +08:00
|
|
|
*
|
|
|
|
* Also fall back on Darwin to allow additional definitions and
|
|
|
|
* implementation-defined values.
|
2011-07-05 22:17:04 +08:00
|
|
|
*/
|
2016-12-08 10:13:56 +08:00
|
|
|
#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
|
|
|
|
__STDC_HOSTED__ && __has_include_next(<float.h>)
|
2017-08-02 06:10:36 +08:00
|
|
|
|
|
|
|
/* Prior to Apple's 10.7 SDK, float.h SDK header used to apply an extra level
|
|
|
|
* of #include_next<float.h> to keep Metrowerks compilers happy. Avoid this
|
|
|
|
* extra indirection.
|
|
|
|
*/
|
|
|
|
#ifdef __APPLE__
|
|
|
|
#define _FLOAT_H_
|
|
|
|
#endif
|
|
|
|
|
2011-07-05 22:17:04 +08:00
|
|
|
# include_next <float.h>
|
|
|
|
|
|
|
|
/* Undefine anything that we'll be redefining below. */
|
|
|
|
# undef FLT_EVAL_METHOD
|
|
|
|
# undef FLT_ROUNDS
|
|
|
|
# undef FLT_RADIX
|
|
|
|
# undef FLT_MANT_DIG
|
|
|
|
# undef DBL_MANT_DIG
|
|
|
|
# undef LDBL_MANT_DIG
|
2016-02-12 09:15:33 +08:00
|
|
|
# if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__)
|
|
|
|
# undef DECIMAL_DIG
|
|
|
|
# endif
|
2011-07-05 22:17:04 +08:00
|
|
|
# undef FLT_DIG
|
|
|
|
# undef DBL_DIG
|
|
|
|
# undef LDBL_DIG
|
|
|
|
# undef FLT_MIN_EXP
|
|
|
|
# undef DBL_MIN_EXP
|
|
|
|
# undef LDBL_MIN_EXP
|
|
|
|
# undef FLT_MIN_10_EXP
|
|
|
|
# undef DBL_MIN_10_EXP
|
|
|
|
# undef LDBL_MIN_10_EXP
|
|
|
|
# undef FLT_MAX_EXP
|
|
|
|
# undef DBL_MAX_EXP
|
|
|
|
# undef LDBL_MAX_EXP
|
|
|
|
# undef FLT_MAX_10_EXP
|
|
|
|
# undef DBL_MAX_10_EXP
|
|
|
|
# undef LDBL_MAX_10_EXP
|
|
|
|
# undef FLT_MAX
|
|
|
|
# undef DBL_MAX
|
|
|
|
# undef LDBL_MAX
|
|
|
|
# undef FLT_EPSILON
|
|
|
|
# undef DBL_EPSILON
|
|
|
|
# undef LDBL_EPSILON
|
|
|
|
# undef FLT_MIN
|
|
|
|
# undef DBL_MIN
|
|
|
|
# undef LDBL_MIN
|
2012-02-07 09:02:19 +08:00
|
|
|
# if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
|
|
|
|
# undef FLT_TRUE_MIN
|
|
|
|
# undef DBL_TRUE_MIN
|
|
|
|
# undef LDBL_TRUE_MIN
|
2016-02-12 03:57:37 +08:00
|
|
|
# undef FLT_DECIMAL_DIG
|
|
|
|
# undef DBL_DECIMAL_DIG
|
|
|
|
# undef LDBL_DECIMAL_DIG
|
2012-02-07 09:02:19 +08:00
|
|
|
# endif
|
2011-07-05 22:17:04 +08:00
|
|
|
#endif
|
|
|
|
|
2008-12-27 01:10:18 +08:00
|
|
|
/* Characteristics of floating point types, C99 5.2.4.2.2 */
|
|
|
|
|
|
|
|
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
|
|
|
#define FLT_ROUNDS (__builtin_flt_rounds())
|
|
|
|
#define FLT_RADIX __FLT_RADIX__
|
|
|
|
|
|
|
|
#define FLT_MANT_DIG __FLT_MANT_DIG__
|
|
|
|
#define DBL_MANT_DIG __DBL_MANT_DIG__
|
|
|
|
#define LDBL_MANT_DIG __LDBL_MANT_DIG__
|
|
|
|
|
2016-02-12 09:15:33 +08:00
|
|
|
#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__)
|
|
|
|
# define DECIMAL_DIG __DECIMAL_DIG__
|
|
|
|
#endif
|
2008-12-27 01:10:18 +08:00
|
|
|
|
2008-12-27 06:49:10 +08:00
|
|
|
#define FLT_DIG __FLT_DIG__
|
|
|
|
#define DBL_DIG __DBL_DIG__
|
|
|
|
#define LDBL_DIG __LDBL_DIG__
|
|
|
|
|
2008-12-27 01:10:18 +08:00
|
|
|
#define FLT_MIN_EXP __FLT_MIN_EXP__
|
|
|
|
#define DBL_MIN_EXP __DBL_MIN_EXP__
|
|
|
|
#define LDBL_MIN_EXP __LDBL_MIN_EXP__
|
|
|
|
|
|
|
|
#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
|
|
|
|
#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
|
|
|
|
#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
|
|
|
|
|
2008-12-27 06:49:10 +08:00
|
|
|
#define FLT_MAX_EXP __FLT_MAX_EXP__
|
|
|
|
#define DBL_MAX_EXP __DBL_MAX_EXP__
|
|
|
|
#define LDBL_MAX_EXP __LDBL_MAX_EXP__
|
|
|
|
|
|
|
|
#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
|
|
|
|
#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
|
|
|
|
#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
|
|
|
|
|
2008-12-27 01:10:18 +08:00
|
|
|
#define FLT_MAX __FLT_MAX__
|
|
|
|
#define DBL_MAX __DBL_MAX__
|
|
|
|
#define LDBL_MAX __LDBL_MAX__
|
|
|
|
|
|
|
|
#define FLT_EPSILON __FLT_EPSILON__
|
|
|
|
#define DBL_EPSILON __DBL_EPSILON__
|
|
|
|
#define LDBL_EPSILON __LDBL_EPSILON__
|
|
|
|
|
|
|
|
#define FLT_MIN __FLT_MIN__
|
|
|
|
#define DBL_MIN __DBL_MIN__
|
|
|
|
#define LDBL_MIN __LDBL_MIN__
|
|
|
|
|
2012-02-07 09:02:19 +08:00
|
|
|
#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
|
|
|
|
# define FLT_TRUE_MIN __FLT_DENORM_MIN__
|
|
|
|
# define DBL_TRUE_MIN __DBL_DENORM_MIN__
|
|
|
|
# define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
|
2016-02-12 03:57:37 +08:00
|
|
|
# define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
|
|
|
|
# define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
|
|
|
|
# define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
|
2012-02-07 09:02:19 +08:00
|
|
|
#endif
|
|
|
|
|
2017-09-13 23:23:19 +08:00
|
|
|
#ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
|
|
|
|
# define FLT16_MANT_DIG __FLT16_MANT_DIG__
|
|
|
|
# define FLT16_DECIMAL_DIG __FLT16_DECIMAL_DIG__
|
|
|
|
# define FLT16_DIG __FLT16_DIG__
|
|
|
|
# define FLT16_MIN_EXP __FLT16_MIN_EXP__
|
|
|
|
# define FLT16_MIN_10_EXP __FLT16_MIN_10_EXP__
|
|
|
|
# define FLT16_MAX_EXP __FLT16_MAX_EXP__
|
|
|
|
# define FLT16_MAX_10_EXP __FLT16_MAX_10_EXP__
|
|
|
|
# define FLT16_MAX __FLT16_MAX__
|
|
|
|
# define FLT16_EPSILON __FLT16_EPSILON__
|
|
|
|
# define FLT16_MIN __FLT16_MIN__
|
|
|
|
# define FLT16_TRUE_MIN __FLT16_TRUE_MIN__
|
|
|
|
#endif /* __STDC_WANT_IEC_60559_TYPES_EXT__ */
|
|
|
|
|
2008-12-27 01:10:18 +08:00
|
|
|
#endif /* __FLOAT_H */
|