| 1 | /* The header float.h defines several macros that expand to various
|
|---|
| 2 | * limits and parameters of the standard floating-point types.
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | #ifndef _FLOAT_
|
|---|
| 6 | #define _FLOAT_
|
|---|
| 7 |
|
|---|
| 8 | /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: indeterminable */
|
|---|
| 9 | #define FLT_ROUNDS 1
|
|---|
| 10 |
|
|---|
| 11 | /* -1: indeterminable;
|
|---|
| 12 | * 0: evaluate all operations and constants;
|
|---|
| 13 | * 1: evaluate float and double to the precision of double, long double to long double
|
|---|
| 14 | * 2: evaluate all operations and constants to the range and precision of the
|
|---|
| 15 | * long double type
|
|---|
| 16 | */
|
|---|
| 17 | #define FLT_EVAL_METHOD 1
|
|---|
| 18 |
|
|---|
| 19 | /*-1: indeterminable; 0: absent; 1: present;*/
|
|---|
| 20 | #define FLT_HAS_SUBNORM 1
|
|---|
| 21 | #define DBL_HAS_SUBNORM 1
|
|---|
| 22 | #define LDBL_HAS_SUBNORM 1
|
|---|
| 23 |
|
|---|
| 24 | /* Radix of exponent representation */
|
|---|
| 25 | #define FLT_RADIX 2
|
|---|
| 26 |
|
|---|
| 27 | /* Number of base-FLT_RADIX digits in the significant of a float */
|
|---|
| 28 | #define FLT_MANT_DIG FLT_MANT_DIG
|
|---|
| 29 | /* Number of base-FLT_RADIX digits in the significant of a double */
|
|---|
| 30 | #define DBL_MANT_DIG DBL_MANT_DIG
|
|---|
| 31 | /* Number of base-FLT_RADIX digits in the significant of a long double */
|
|---|
| 32 | #define LDBL_MANT_DIG LDBL_MANT_DIG
|
|---|
| 33 |
|
|---|
| 34 | /* Number of decimal digits */
|
|---|
| 35 | #define DECIMAL_DIG 10
|
|---|
| 36 | #define FLT_DIG 6
|
|---|
| 37 | #define DBL_DIG 10
|
|---|
| 38 | #define LDBL_DIG 10
|
|---|
| 39 |
|
|---|
| 40 | /* Minimum negative integer */
|
|---|
| 41 | #define FLT_MIN_EXP FLT_MIN_EXP
|
|---|
| 42 | #define DBL_MIN_EXP DBL_MIN_EXP
|
|---|
| 43 | #define LDBL_MIN_EXP LDBL_MIN_EXP
|
|---|
| 44 | #define FLT_MIN_10_EXP -37
|
|---|
| 45 | #define DBL_MIN_10_EXP -37
|
|---|
| 46 | #define LDBL_MIN_10_EXP -37
|
|---|
| 47 |
|
|---|
| 48 | /* Maximum integer */
|
|---|
| 49 | #define FLT_MAX_EXP FLT_MAX_EXP // eg: 32
|
|---|
| 50 | #define DBL_MAX_EXP DBL_MAX_EXP // eg: 1024
|
|---|
| 51 | #define LDBL_MAX_EXP LDBL_MAX_EXP
|
|---|
| 52 | #define FLT_MAX_10_EXP +37
|
|---|
| 53 | #define DBL_MAX_10_EXP +37
|
|---|
| 54 | #define LDBL_MAX_10_EXP +37
|
|---|
| 55 |
|
|---|
| 56 | /* Maximum representable finite floating-point number */
|
|---|
| 57 | #define FLT_MAX 1E+37
|
|---|
| 58 | #define DBL_MAX 1E+37
|
|---|
| 59 | #define LDBL_MAX 1E+37
|
|---|
| 60 |
|
|---|
| 61 | /* The difference between 1 and the least value greater than 1 that is representable in the
|
|---|
| 62 | * given floating point type
|
|---|
| 63 | */
|
|---|
| 64 | #define FLT_EPSILON 1E-5
|
|---|
| 65 | #define DBL_EPSILON 1E-9
|
|---|
| 66 | #define LDBL_EPSILON 1E-9
|
|---|
| 67 |
|
|---|
| 68 | /* minimum normalized positive floating-point number */
|
|---|
| 69 | #define FLT_MIN 1E-37
|
|---|
| 70 | #define DBL_MIN 1E-37
|
|---|
| 71 | #define LDBL_MIN 1E-37
|
|---|
| 72 |
|
|---|
| 73 | /* Minimum positive floating-point number */
|
|---|
| 74 | #define FLT_TRUE_MIN 1E-37
|
|---|
| 75 | #define DBL_TRUE_MIN 1E-37
|
|---|
| 76 | #define LDBL_TRUE_MIN 1E-37
|
|---|
| 77 |
|
|---|
| 78 | #endif
|
|---|