Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

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