1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6 #ifndef _FP_CONSTS_H 7 #define _FP_CONSTS_H 8 9 /* 10 According to IEEE 754 a QNaN has exponent bits of all 1 values and 11 initial significand bit of 1. A SNaN has has an exponent of all 1 12 values and initial significand bit of 0 (with one or more other 13 significand bits of 1). An Inf has significand of 0 and 14 exponent of all 1 values. A denormal value has all exponent bits of 0. 15 16 The following does _not_ follow those rules, but uses values 17 equal to those exported from MS C++ runtime lib, msvcprt.dll 18 for float and double. MSVC however, does not have long doubles. 19 */ 20 21 22 #define __DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 } 23 #define __DOUBLE_QNAN_REP { 0, 0, 0, 0xfff8 } /* { 0, 0, 0, 0x7ff8 } */ 24 #define __DOUBLE_SNAN_REP { 0, 0, 0, 0xfff0 } /* { 1, 0, 0, 0x7ff0 } */ 25 #define __DOUBLE_DENORM_REP {1, 0, 0, 0} 26 27 #define D_NAN_MASK 0x7ff0000000000000LL /* this will mask NaN's and Inf's */ 28 29 #define __FLOAT_INF_REP { 0, 0x7f80 } 30 #define __FLOAT_QNAN_REP { 0, 0xffc0 } /* { 0, 0x7fc0 } */ 31 #define __FLOAT_SNAN_REP { 0, 0xff80 } /* { 1, 0x7f80 } */ 32 #define __FLOAT_DENORM_REP {1,0} 33 34 #define F_NAN_MASK 0x7f800000 35 36 /* 37 This assumes no implicit (hidden) bit in extended mode. 38 Padded to 96 bits 39 */ 40 #define __LONG_DOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff, 0 } 41 #define __LONG_DOUBLE_QNAN_REP { 0, 0, 0, 0xc000, 0xffff, 0 } 42 #define __LONG_DOUBLE_SNAN_REP { 0, 0, 0, 0x8000, 0xffff, 0 } 43 #define __LONG_DOUBLE_DENORM_REP {1, 0, 0, 0, 0, 0} 44 45 union _ieee_rep 46 { 47 unsigned short rep[6]; 48 float float_val; 49 double double_val; 50 long double ldouble_val; 51 }; 52 53 #endif /* _FP_CONSTS_H */ 54 55