Leaked source code of windows server 2003
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.

52 lines
1.3 KiB

  1. /* _LDtest function -- IEEE 754 version */
  2. #include "wctype.h"
  3. #include "xmath.h"
  4. _STD_BEGIN
  5. #if !_DLONG
  6. _CRTIMP2 short _LDtest(long double *px)
  7. { /* categorize *px */
  8. return (_Dtest((double *)px));
  9. }
  10. #elif _LONG_DOUBLE_HAS_HIDDEN_BIT
  11. _CRTIMP2 short _LDtest(long double *px)
  12. { /* categorize *px -- SPARC */
  13. unsigned short *ps = (unsigned short *)px;
  14. short xchar = ps[_L0] & _LMASK;
  15. if (xchar == _LMAX)
  16. return (ps[_L1] != 0 || ps[_L2] != 0 || ps[_L3] != 0
  17. || ps[_L4] != 0 || ps[_L5] != 0 || ps[_L6] != 0
  18. || ps[_L7] != 0 ? NAN : INF);
  19. else if (0 < xchar || ps[_L1] || ps[_L2] || ps[_L3]
  20. || ps[_L4] || ps[_L5] || ps[_L6] || ps[_L7])
  21. return (FINITE);
  22. else
  23. return (0);
  24. }
  25. #else /* _DLONG && !_LONG_DOUBLE_HAS_HIDDEN_BIT */
  26. _CRTIMP2 short _LDtest(long double *px)
  27. { /* categorize *px */
  28. unsigned short *ps = (unsigned short *)px;
  29. short xchar = ps[_L0] & _LMASK;
  30. if (xchar == _LMAX)
  31. return ((ps[_L1] & 0x7fff) != 0 || ps[_L2] != 0
  32. || ps[_L3] != 0 || ps[_L4] != 0 ? NAN : INF);
  33. else if (0 < xchar || ps[_L1] != 0 || ps[_L2] || ps[_L3]
  34. || ps[_L4])
  35. return (FINITE);
  36. else
  37. return (0);
  38. }
  39. #endif
  40. _STD_END
  41. /*
  42. * Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED.
  43. * Consult your license regarding permissions and restrictions.
  44. */
  45. /*
  46. 941029 pjp: added _STD machinery
  47. */