Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.7 KiB

  1. /* values used by math functions -- IEEE 754 long version */
  2. #include "wctype.h"
  3. #include "xmath.h"
  4. _STD_BEGIN
  5. #if _DLONG /* long double has unique representation */
  6. /* macros */
  7. #define NBITS 64
  8. #if _D0
  9. #define INIT(w0, w1) {0, 0, 0, w1, w0}
  10. #define INIT3(w0, w1, wn) {wn, 0, 0, w1, w0}
  11. #else
  12. #define INIT(w0, w1) {w0, w1, 0, 0, 0}
  13. #define INIT3(w0, w1, wn) {w0, w1, 0, 0, wn}
  14. #endif
  15. /* static data */
  16. _CRTIMP2 const _Dconst _LDenorm = {INIT3(0, 0, 1)};
  17. _CRTIMP2 const _Dconst _LEps = {INIT(_LBIAS - NBITS - 1, 0x8000)};
  18. #if _LONG_DOUBLE_HAS_HIDDEN_BIT
  19. _CRTIMP2 const _Dconst _LInf = {INIT(_LMAX, 0)};
  20. _CRTIMP2 const _Dconst _LNan = {INIT(_LSIGN | _LMAX, 0x8000)};
  21. _CRTIMP2 const _Dconst _LSnan = {INIT(_LSIGN | _LMAX, 0)};
  22. #else
  23. _CRTIMP2 const _Dconst _LInf = {INIT(_LMAX, 0x8000)};
  24. _CRTIMP2 const _Dconst _LNan = {INIT(_LSIGN | _LMAX, 0xc000)};
  25. _CRTIMP2 const _Dconst _LSnan = {INIT(_LSIGN | _LMAX, 0x8000)};
  26. #endif
  27. _CRTIMP2 const _Dconst _LRteps = {INIT(_LBIAS - NBITS / 2, 0x8000)};
  28. _CRTIMP2 const long double _LXbig = (NBITS + 1) * 347L / 1000;
  29. #if defined(__CENTERLINE__)
  30. #define _DYNAMIC_INIT_CONST(x) \
  31. (x._L = *(long double *)(void *)(x._W))
  32. long double _centerline_long_double_dynamic_init =
  33. _DYNAMIC_INIT_CONST(_LEps),
  34. _DYNAMIC_INIT_CONST(_LInf),
  35. _DYNAMIC_INIT_CONST(_LNan),
  36. _DYNAMIC_INIT_CONST(_LRteps);
  37. #endif
  38. #else /* long double same representation as double */
  39. /* macros */
  40. #define NBITS (48 + _DOFF)
  41. #if _D0
  42. #define INIT(w0) {0, 0, 0, w0}
  43. #define INIT2(w0, w1) {w1, 0, 0, w0}
  44. #else
  45. #define INIT(w0) {w0, 0, 0, 0}
  46. #define INIT2(w0, w1) {w0, 0, 0, w1}
  47. #endif
  48. /* static data */
  49. _CRTIMP2 const _Dconst _LDenorm = {INIT2(0, 1)};
  50. _CRTIMP2 const _Dconst _LEps = {INIT((_DBIAS - NBITS - 1) << _DOFF)};
  51. _CRTIMP2 const _Dconst _LInf = {INIT(_DMAX << _DOFF)};
  52. _CRTIMP2 const _Dconst _LNan = {INIT(_DSIGN | (_DMAX << _DOFF)
  53. | (1 << (_DOFF - 1)))};
  54. _CRTIMP2 const _Dconst _LRteps = {INIT((_DBIAS - NBITS / 2) << _DOFF)};
  55. _CRTIMP2 const _Dconst _LSnan = {INIT(_DSIGN | (_DMAX << _DOFF))};
  56. _CRTIMP2 const long double _LXbig = (NBITS + 1) * 347L / 1000;
  57. #if defined(__CENTERLINE__)
  58. #define _DYNAMIC_INIT_CONST(x) \
  59. (x._D = *(long double *)(void *)(x._W))
  60. long double _centerline_long_double_dynamic_inits =
  61. _DYNAMIC_INIT_CONST(_LEps),
  62. _DYNAMIC_INIT_CONST(_LInf),
  63. _DYNAMIC_INIT_CONST(_LNan),
  64. _DYNAMIC_INIT_CONST(_LRteps);
  65. #endif
  66. #endif
  67. _STD_END
  68. /*
  69. * Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED.
  70. * Consult your license regarding permissions and restrictions.
  71. */
  72. /*
  73. 941029 pjp: added _STD machinery
  74. 950222 pjp: added signaling NaN, denorm minimum for C++
  75. 950506 pjp: corrected _LDenorm spelling
  76. 951005 pjp: added _DLONG logic
  77. 951115 pjp: corrected _LXbig type
  78. */