home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / win3 / patches / symantec / rtlinc.exe / FLTPNT.H < prev    next >
C/C++ Source or Header  |  1993-06-15  |  4KB  |  140 lines

  1. /*_ fltpnt.h   Sat Mar 30 1991   Modified by: Walter Bright */
  2.  
  3. #ifndef __FLTPNT_H
  4. #define __FLTPNT_H    1
  5.  
  6. #if __cplusplus
  7. extern "C" {
  8. #endif
  9.  
  10. #ifdef __STDC__
  11. #define __CDECL
  12. #define __STDCALL
  13. #else
  14. #define __CDECL __cdecl
  15. #define __STDCALL __stdcall
  16. #endif
  17.  
  18. #if __OS2__ && __INTSIZE == 4
  19. #define __CLIB    __STDCALL
  20. #else
  21. #define __CLIB    __CDECL
  22. #endif
  23.  
  24. typedef float float_t;
  25. typedef double double_t;
  26.  
  27. #if __SC__ >= 0x300
  28. #define INFINITY    __inf
  29. #define    NAN        __nan
  30. #define NANS        __nans
  31. #endif
  32.  
  33. #define    FP_NANS        0
  34. #define FP_NANQ        1
  35. #define    FP_INFINITE    2
  36. #define    FP_NORMAL    3
  37. #define    FP_SUBNORMAL    4
  38. #define    FP_ZERO        5
  39.  
  40. unsigned __CDECL __fpclassify_f(float);
  41. unsigned __CDECL __fpclassify_d(double);
  42.  
  43. #if __cplusplus
  44. extern "C++" {
  45. inline int fpclassify(float fe)    { return __fpclassify_f(fe); }
  46. inline int fpclassify(double fe){ return __fpclassify_d(fe); }
  47. inline int signbit(float fe)    { return ((short *)&(fe))[1] & 0x8000; }
  48. inline int signbit(double fe)    { return ((short *)&(fe))[3] & 0x8000; }
  49. inline int isfinite(float fe)    { return fpclassify(fe) >= FP_NORMAL; }
  50. inline int isfinite(double fe)    { return fpclassify(fe) >= FP_NORMAL; }
  51. inline int isnormal(float fe)    { return fpclassify(fe) == FP_NORMAL; }
  52. inline int isnormal(double fe)    { return fpclassify(fe) == FP_NORMAL; }
  53. inline int isnan(float fe)    { return fpclassify(fe) <= FP_NANQ;   }
  54. inline int isnan(double fe)    { return fpclassify(fe) <= FP_NANQ;   }
  55. }
  56. #else
  57. #define fpclassify(fe)    (sizeof(fe) == sizeof(float) ?            \
  58.                 __fpclassify_f(fe) :            \
  59.                 __fpclassify_d(fe))
  60. #define signbit(fe)    (sizeof(fe) == sizeof(float) ?            \
  61.                 (int)(((short *)&(fe))[1] & 0x8000) :    \
  62.                 (int)(((short *)&(fe))[3] & 0x8000))
  63. #define isfinite(fe)    (fpclassify(fe) >= FP_NORMAL)
  64. #define isnormal(fe)    (fpclassify(fe) == FP_NORMAL)
  65. #define isnan(fe)    (fpclassify(fe) <= FP_NANQ)
  66. #endif
  67.  
  68. double        __CDECL copysign(double x,double y);
  69. float        __CDECL copysignf(float x,float y);
  70. long double    __CDECL copysignl(long double x,long double y);
  71.  
  72. double __CDECL logb(double x);
  73. float __CDECL logbf(float x);
  74. long double __CDECL logbl(long double x);
  75.  
  76. double __CDECL nextafter(double x,double y);
  77. float __CDECL nextafterf(float x,float y);
  78. long double __CDECL nextafterl(long double x,long double y);
  79.  
  80. double __CDECL scalb(double x,long int n);
  81. float __CDECL scalbf(float x,long int n);
  82. long double __CDECL scalbl(long double x,long int n);
  83.  
  84. double __CDECL nan(const char *tagp);
  85. float __CDECL nanf(const char *tagp);
  86. long double __CDECL nanl(const char *tagp);
  87.  
  88. double __CDECL nans(const char *tagp);
  89. float __CDECL nansf(const char *tagp);
  90. long double __CDECL nansl(const char *tagp);
  91.  
  92. double __CDECL remainder(double x,double y);
  93. float __CDECL remainderf(float x,float y);
  94. long double __CDECL remainderl(long double x,long double y);
  95.  
  96. double __CDECL remquo(double x,double y,int *quo);
  97. float __CDECL remquof(float x,float y,int *quo);
  98. long double __CDECL remquol(long double x,long double y,int *quo);
  99.  
  100. double __CDECL rint(double x);
  101. float __CDECL rintf(float x);
  102. long double __CDECL rintl(long double x);
  103.  
  104. double __CDECL round(double x);
  105. float __CDECL roundf(float x);
  106. long double __CDECL roundl(long double x);
  107.  
  108. double __CDECL nearbyint(double x);
  109. float __CDECL nearbyintf(float x);
  110. long double __CDECL nearbyintl(long double x);
  111.  
  112. double __CDECL trunc(double x);
  113. float __CDECL truncf(float x);
  114. long double __CDECL truncl(long double x);
  115.  
  116. long int __CDECL rndtol(long double x);
  117. long int __CDECL rndtonl(long double x);
  118.  
  119. /* long double is same as double    */
  120. #define copysignl    copysign
  121. #define logbl        logb
  122. #define nextafterl    nextafter
  123. #define scalbl        scalb
  124. #define nanl        nan
  125. #define nansl        nans
  126. #define remainderl    remainder
  127. #define remquol        remquo
  128. #define rintl        rint
  129. #define roundl        round
  130. #define nearbyintl    nearbyint
  131. #define truncl        trunc
  132.  
  133.  
  134. #if __cplusplus
  135. }
  136. #endif
  137.  
  138. #endif /* __FLTPNT_H */
  139.  
  140.