home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / xvalues.c < prev    next >
C/C++ Source or Header  |  1998-06-16  |  1KB  |  47 lines

  1. /* values used by math functions -- IEEE 754 version */
  2. #include "wctype.h"
  3. #include "xmath.h"
  4. _STD_BEGIN
  5.  
  6.         /* macros */
  7. #define NBITS    (48 + _DOFF)
  8. #if _D0
  9.  #define INIT(w0)        {0, 0, 0, w0}
  10.  #define INIT2(w0, w1)    {w1, 0, 0, w0}
  11. #else
  12.  #define INIT(w0)        {w0, 0, 0, 0}
  13.  #define INIT2(w0, w1)    {w0, 0, 0, w1}
  14. #endif
  15.         /* static data */
  16. _CRTIMP2 const _Dconst _Denorm = {INIT2(0, 1)};
  17. _CRTIMP2 const _Dconst _Eps = {INIT((_DBIAS - NBITS - 1) << _DOFF)};
  18. _CRTIMP2 const _Dconst _Hugeval = {INIT(_DMAX << _DOFF)};
  19. _CRTIMP2 const _Dconst _Inf = {INIT(_DMAX << _DOFF)};
  20. _CRTIMP2 const _Dconst _Nan = {INIT(_DSIGN | (_DMAX << _DOFF)
  21.     | (1 << _DOFF - 1))};
  22. _CRTIMP2 const _Dconst _Rteps = {INIT((_DBIAS - NBITS / 2) << _DOFF)};
  23. _CRTIMP2 const _Dconst _Snan = {INIT(_DSIGN | (_DMAX << _DOFF))};
  24. _CRTIMP2 const double _Xbig = (NBITS + 1) * 347L / 1000;
  25.  
  26. #if defined(__CENTERLINE__)
  27.  #define _DYNAMIC_INIT_CONST(x) \
  28.     (x._D = *(double *)(void *)(x._W))
  29. double _centerline_double_dynamic_inits =
  30. _DYNAMIC_INIT_CONST(_Hugeval),
  31. _DYNAMIC_INIT_CONST(_Eps),
  32. _DYNAMIC_INIT_CONST(_Inf),
  33. _DYNAMIC_INIT_CONST(_Nan),
  34. _DYNAMIC_INIT_CONST(_Rteps);
  35. #endif
  36. _STD_END
  37.  
  38. /*
  39.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  40.  * Consult your license regarding permissions and restrictions.
  41.  */
  42.  
  43. /*
  44. 941029 pjp: added _STD machinery
  45. 950222 pjp: added signaling NaN, denorm minimum for C++
  46.  */
  47.