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

  1. /* _FDtest function -- IEEE 754 version */
  2. #include "wctype.h"
  3. #include "xmath.h"
  4. _STD_BEGIN
  5.  
  6. _CRTIMP2 short _FDtest(float *px)
  7.     {    /* categorize *px */
  8.     unsigned short *ps = (unsigned short *)px;
  9.  
  10.     if ((ps[_F0] & _FMASK) == _FMAX << _FOFF)
  11.         return ((ps[_F0] & _FFRAC) != 0 || ps[_F1] != 0
  12.             ? NAN : INF);
  13.     else if ((ps[_F0] & ~_FSIGN) != 0 || ps[_F1] != 0)
  14.         return (FINITE);
  15.     else
  16.         return (0);
  17.     }
  18. _STD_END
  19.  
  20. /*
  21.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  22.  * Consult your license regarding permissions and restrictions.
  23.  */
  24.  
  25. /*
  26. 941029 pjp: added _STD machinery
  27.  */
  28.