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

  1. /* values used by math functions -- IEEE 754 float version */
  2. #include "wctype.h"
  3. #include "xmath.h"
  4. _STD_BEGIN
  5.  
  6.         /* macros */
  7. #define NBITS    (16 + _FOFF)
  8. #if _D0
  9.  #define INIT(w0)        {0, w0}
  10.  #define INIT2(w0, w1)    {w1, w0}
  11. #else
  12.  #define INIT(w0)        {w0, 0}
  13.  #define INIT2(w0, w1)    {w0, w1}
  14. #endif
  15.         /* static data */
  16. _CRTIMP2 const _Dconst _FDenorm = {INIT2(0, 1)};
  17. _CRTIMP2 const _Dconst _FEps = {INIT((_FBIAS - NBITS - 1) << _FOFF)};
  18. _CRTIMP2 const _Dconst _FInf = {INIT(_FMAX << _FOFF)};
  19. _CRTIMP2 const _Dconst _FNan = {INIT(_FSIGN | (_FMAX << _FOFF)
  20.     | (1 << _FOFF - 1))};
  21. _CRTIMP2 const _Dconst _FSnan = {INIT(_FSIGN | (_FMAX << _FOFF))};
  22. _CRTIMP2 const _Dconst _FRteps = {INIT((_FBIAS - NBITS / 2) << _FOFF)};
  23. _CRTIMP2 const float _FXbig = (NBITS + 1) * 347L / 1000;
  24.  
  25. #if defined(__CENTERLINE__)
  26.  #define _DYNAMIC_INIT_CONST(x) \
  27.     (x._F = *(float *)(void *)(x._W))
  28. _DYNAMIC_INIT_CONST(_FEps);
  29. _DYNAMIC_INIT_CONST(_FInf);
  30. _DYNAMIC_INIT_CONST(_FNan);
  31. _DYNAMIC_INIT_CONST(_FRteps);
  32. #endif
  33. _STD_END
  34.  
  35. /*
  36.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  37.  * Consult your license regarding permissions and restrictions.
  38.  */
  39.  
  40. /*
  41. 941029 pjp: added _STD machinery
  42. 950222 pjp: added signaling NaN, denorm minimum for C++
  43. 950405 pjp: corrected _FSnan punctuation
  44. 950505 pjp: corrected _FDenorm spelling
  45.  */
  46.