home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / float.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  8.6 KB  |  264 lines

  1. /*  float.h
  2.  
  3.     Defines implementation specific macros for dealing with
  4.     floating point.
  5.  
  6. */
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 10.0
  10.  *
  11.  *      Copyright (c) 1987, 2000 by Inprise Corporation
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16. /* $Revision:   9.11  $ */
  17.  
  18. #ifndef __FLOAT_H
  19. #define __FLOAT_H
  20.  
  21. #ifndef ___STDDEF_H
  22. #include <_stddef.h>
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. namespace std {
  27. #endif /* __cplusplus */
  28.  
  29.  
  30. #if !defined(RC_INVOKED)
  31.  
  32. #if defined(__STDC__)
  33. #pragma warn -nak
  34. #endif
  35.  
  36. #endif  /* !RC_INVOKED */
  37.  
  38.  
  39. #define FLT_RADIX           2
  40. #define FLT_ROUNDS          1
  41. #define FLT_GUARD           1
  42. #define FLT_NORMALIZE       1
  43.  
  44. #define DBL_DIG             15
  45. #define FLT_DIG             6
  46. #define LDBL_DIG            18
  47.  
  48. #define DBL_MANT_DIG        53
  49. #define FLT_MANT_DIG        24
  50. #define LDBL_MANT_DIG       64
  51.  
  52. #define DBL_EPSILON         2.2204460492503131E-16
  53. #define FLT_EPSILON         1.19209290E-07F
  54. #define LDBL_EPSILON        1.084202172485504434e-019L
  55.  
  56. /* smallest positive IEEE normal numbers */
  57. #define DBL_MIN             2.2250738585072014E-308
  58. #define FLT_MIN             1.17549435E-38F
  59. #define LDBL_MIN            _tiny_ldble
  60.  
  61. #define DBL_MAX             _max_dble
  62. #define FLT_MAX             _max_flt
  63. #define LDBL_MAX            _max_ldble
  64.  
  65. #define DBL_MAX_EXP         +1024
  66. #define FLT_MAX_EXP         +128
  67. #define LDBL_MAX_EXP        +16384
  68.  
  69. #define DBL_MAX_10_EXP      +308
  70. #define FLT_MAX_10_EXP      +38
  71. #define LDBL_MAX_10_EXP     +4932
  72.  
  73. #define DBL_MIN_10_EXP      -307
  74. #define FLT_MIN_10_EXP      -37
  75. #define LDBL_MIN_10_EXP     -4931
  76.  
  77. #define DBL_MIN_EXP         -1021
  78. #define FLT_MIN_EXP         -125
  79. #define LDBL_MIN_EXP        -16381
  80.  
  81. #ifdef __cplusplus
  82. extern "C" {
  83. #endif
  84.  
  85. extern float        _RTLENTRY _EXPDATA _max_flt;
  86. extern double       _RTLENTRY _EXPDATA _max_dble;
  87. extern long double  _RTLENTRY _EXPDATA _max_ldble;
  88. extern long double  _RTLENTRY _EXPDATA _tiny_ldble;
  89.  
  90. unsigned int _RTLENTRY            _clear87(void);
  91. unsigned int _RTLENTRY            _control87(unsigned int __newcw, unsigned int __mask);
  92. void         _RTLENTRY            _fpreset(void);
  93. unsigned int _RTLENTRY            _status87(void);
  94.  
  95. /* Microsoft C compatible IEEE functions */
  96.  
  97. double       _RTLENTRY _EXPFUNC  _chgsign(double __d);
  98. double       _RTLENTRY _EXPFUNC  _copysign(double __da, double __db);
  99. int          _RTLENTRY _EXPFUNC  _finite(double __d);
  100. int          _RTLENTRY _EXPFUNC  _fpclass(double __d);
  101. int          _RTLENTRY _EXPFUNC  _isnan(double __d);
  102. double       _RTLENTRY _EXPFUNC  _logb(double __d);
  103. double       _RTLENTRY _EXPFUNC  _scalb(double __d, long __exp);
  104. double       _RTLENTRY _EXPFUNC  _nextafter(double __da, double __db);
  105.  
  106. long double  _RTLENTRY _EXPFUNC  _chgsignl(long double __ld);
  107. long double  _RTLENTRY _EXPFUNC  _copysignl(long double __lda, long double __ldb);
  108. int          _RTLENTRY _EXPFUNC  _finitel(long double __ld);
  109. int          _RTLENTRY _EXPFUNC  _fpclassl(long double __ld);
  110. int          _RTLENTRY _EXPFUNC  _isnanl(long double __ld);
  111. long double  _RTLENTRY _EXPFUNC  _logbl(long double __ld);
  112. long double  _RTLENTRY _EXPFUNC  _scalbl(long double __ld, long __exp);
  113. long double  _RTLENTRY _EXPFUNC  _nextafterl(long double __lda, long double __ldb);
  114.  
  115. #define      _controlfp(__a, __b) _control87((__a), ((__b)& (~EM_DENORMAL)))
  116. #define      _statusfp            _status87
  117. #define      _clearfp             _clear87
  118.  
  119. /* Return values for _fpclass() and _fpclassl() */
  120.  
  121. #define _FPCLASS_UNSUP  0x0000  /* Unsupported IEEE format      */
  122. #define _FPCLASS_SNAN   0x0001  /* Signaling NaN                */
  123. #define _FPCLASS_QNAN   0x0002  /* Quiet NaN                    */
  124. #define _FPCLASS_NINF   0x0004  /* Negative Infinity            */
  125. #define _FPCLASS_NN     0x0008  /* Negative Normal              */
  126. #define _FPCLASS_ND     0x0010  /* Negative Denormal            */
  127. #define _FPCLASS_NZ     0x0020  /* Negative Zero (-0.0)         */
  128. #define _FPCLASS_PZ     0x0040  /* Positive Zero (+0.0)         */
  129. #define _FPCLASS_PD     0x0080  /* Positive Denormal            */
  130. #define _FPCLASS_PN     0x0100  /* Positive Normal              */
  131. #define _FPCLASS_PINF   0x0200  /* Positive Infinity            */
  132.  
  133.  
  134. #ifdef __cplusplus
  135. } // "C"
  136. #endif
  137.  
  138. #if !defined(__STDC__)
  139.  
  140. /* 387 Status Word format   */
  141.  
  142. #define SW_INVALID      0x0001  /* Invalid operation            */
  143. #define SW_DENORMAL     0x0002  /* Denormalized operand         */
  144. #define SW_ZERODIVIDE   0x0004  /* Zero divide                  */
  145. #define SW_OVERFLOW     0x0008  /* Overflow                     */
  146. #define SW_UNDERFLOW    0x0010  /* Underflow                    */
  147. #define SW_INEXACT      0x0020  /* Precision (Inexact result)   */
  148. #define SW_STACKFAULT   0x0040  /* Stack fault                  */
  149.  
  150. /* 387 Control Word format */
  151.  
  152. #define MCW_EM              0x003f  /* interrupt Exception Masks*/
  153. #define     EM_INVALID      0x0001  /*   invalid                */
  154. #define     EM_DENORMAL     0x0002  /*   denormal               */
  155. #define     EM_ZERODIVIDE   0x0004  /*   zero divide            */
  156. #define     EM_OVERFLOW     0x0008  /*   overflow               */
  157. #define     EM_UNDERFLOW    0x0010  /*   underflow              */
  158. #define     EM_INEXACT      0x0020  /*   inexact (precision)    */
  159.  
  160. #define MCW_IC              0x1000  /* Infinity Control */
  161. #define     IC_AFFINE       0x1000  /*   affine         */
  162. #define     IC_PROJECTIVE   0x0000  /*   projective     */
  163.  
  164. #define MCW_RC          0x0c00  /* Rounding Control     */
  165. #define     RC_CHOP     0x0c00  /*   chop               */
  166. #define     RC_UP       0x0800  /*   up                 */
  167. #define     RC_DOWN     0x0400  /*   down               */
  168. #define     RC_NEAR     0x0000  /*   near               */
  169.  
  170. #define MCW_PC          0x0300  /* Precision Control    */
  171. #define     PC_24       0x0000  /*    24 bits           */
  172. #define     PC_53       0x0200  /*    53 bits           */
  173. #define     PC_64       0x0300  /*    64 bits           */
  174.  
  175. #ifdef __cplusplus
  176. } // std
  177. #endif /* __cplusplus */
  178.  
  179. /* 387 Initial Control Word */
  180. /* use affine infinity, mask underflow and precision exceptions */
  181.  
  182. #define CW_DEFAULT  _default87
  183. extern unsigned int _RTLENTRY _default87;
  184.  
  185. #ifdef __cplusplus
  186. namespace std {
  187. #endif /* __cplusplus */
  188.  
  189. /*
  190.     SIGFPE signal error types (for integer & float exceptions).
  191. */
  192. #define FPE_INTOVFLOW       126 /* 80x86 Interrupt on overflow  */
  193. #define FPE_INTDIV0         127 /* 80x86 Integer divide by zero */
  194.  
  195. #define FPE_INVALID         129 /* 80x87 invalid operation      */
  196. #define FPE_ZERODIVIDE      131 /* 80x87 divide by zero         */
  197. #define FPE_OVERFLOW        132 /* 80x87 arithmetic overflow    */
  198. #define FPE_UNDERFLOW       133 /* 80x87 arithmetic underflow   */
  199. #define FPE_INEXACT         134 /* 80x87 precision loss         */
  200. #define FPE_STACKFAULT      135 /* 80x87 stack overflow         */
  201. #define FPE_EXPLICITGEN     140 /* When SIGFPE is raise()'d     */
  202.  
  203. /*
  204.             SIGSEGV signal error types.
  205. */
  206. #define SEGV_BOUND          10  /* A BOUND violation (SIGSEGV)  */
  207. #define SEGV_EXPLICITGEN    11  /* When SIGSEGV is raise()'d    */
  208. #define SEGV_ACCESS         12  /* Access violation */
  209. #define SEGV_STACK          13  /* Unable to grow stack */
  210.  
  211. /*
  212.             SIGILL signal error types.
  213. */
  214. #define ILL_EXECUTION       20  /* Illegal operation exception  */
  215. #define ILL_EXPLICITGEN     21  /* When SIGILL is raise()'d     */
  216. #define ILL_PRIVILEGED      22  /* Privileged instruction */
  217. #define ILL_BREAKPOINT      23  /* Breakpoint exception */
  218. #define ILL_SINGLE_STEP     24  /* Singlestep exception */
  219.  
  220. #endif  /* !__STDC__ */
  221.  
  222.  
  223. #if !defined(RC_INVOKED)
  224.  
  225. #if defined(__STDC__)
  226. #pragma warn .nak
  227. #endif
  228.  
  229. #endif  /* !RC_INVOKED */
  230.  
  231. #ifdef __cplusplus
  232. } // std
  233. #endif /* __cplusplus */
  234.  
  235. #endif  /* __FLOAT_H */
  236.  
  237. #if defined(__cplusplus) && !defined(__USING_CNAME__) && !defined(__FLOAT_H_USING_LIST)
  238. #define __FLOAT_H_USING_LIST
  239.      using std::_chgsign;
  240.      using std::_chgsignl;
  241.      using std::_clear87;
  242.      using std::_control87;
  243.      using std::_copysign;
  244.      using std::_copysignl;
  245.      using std::_finite;
  246.      using std::_finitel;
  247.      using std::_fpclass;
  248.      using std::_fpclassl;
  249.      using std::_fpreset;
  250.      using std::_isnan;
  251.      using std::_isnanl;
  252.      using std::_logb;
  253.      using std::_logbl;
  254.      using std::_max_dble;
  255.      using std::_max_flt;
  256.      using std::_max_ldble;
  257.      using std::_nextafter;
  258.      using std::_nextafterl;
  259.      using std::_scalb;
  260.      using std::_scalbl;
  261.      using std::_status87;
  262.      using std::_tiny_ldble;
  263. #endif /* __USING_CNAME__ */
  264.