home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / d / djdev108.zip / INCLUDE / VALUES.H < prev    next >
C/C++ Source or Header  |  1992-03-09  |  6KB  |  170 lines

  1. /* This is file values.h */
  2. /* This file may have been modified by DJ Delorie (Jan 1991).  If so,
  3. ** these modifications are Coyright (C) 1991 DJ Delorie, 24 Kirsten Ave,
  4. ** Rochester NH, 03867-2954, USA.
  5. */
  6.  
  7. /* This may look like C code, but it is really -*- C++ -*- */
  8. /* 
  9. Copyright (C) 1988 Free Software Foundation
  10.     written by Doug Lea (dl@rocky.oswego.edu)
  11.  
  12. This file is part of GNU CC.
  13.  
  14. GNU CC is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY.  No author or distributor
  16. accepts responsibility to anyone for the consequences of using it
  17. or for whether it serves any particular purpose or works at all,
  18. unless he says so in writing.  Refer to the GNU CC General Public
  19. License for full details.
  20.  
  21. Everyone is granted permission to copy, modify and redistribute
  22. GNU CC, but only under the conditions described in the
  23. GNU CC General Public License.   A copy of this license is
  24. supposed to have been given to you along with GNU CC so you
  25. can know your rights and responsibilities.  It should be in a
  26. file named COPYING.  Among other things, the copyright notice
  27. and this notice must be preserved on all copies.  
  28. */
  29.  
  30.  
  31. #ifndef _values_h
  32. #define _values_h 1
  33.  
  34. #define BITSPERBYTE 8
  35. #define BITS(type)  (BITSPERBYTE * (int)sizeof(type))
  36.  
  37. #define CHARBITS    BITS(char)
  38. #define SHORTBITS   BITS(short)
  39. #define INTBITS     BITS(int)
  40. #define LONGBITS    BITS(long)
  41. #define PTRBITS     BITS(char*)
  42. #define DOUBLEBITS  BITS(double)
  43. #define FLOATBITS   BITS(float)
  44.  
  45. #define MINSHORT    ((short)(1 << (SHORTBITS - 1)))
  46. #define MININT      (1 << (INTBITS - 1))
  47. #define MINLONG     (1L << (LONGBITS - 1))
  48.  
  49. #define MAXSHORT    ((short)~MINSHORT)
  50. #define MAXINT      (~MININT)
  51. #define MAXLONG     (~MINLONG)
  52.  
  53. #if defined(sun) || defined(hp300) || defined(hpux)
  54. #define MAXDOUBLE   1.79769313486231470e+308
  55. #define MAXFLOAT    ((float)3.40282346638528860e+38)
  56. #define MINDOUBLE   4.94065645841246544e-324
  57. #define MINFLOAT    ((float)1.40129846432481707e-45)
  58. #define _IEEE       1
  59. #define _DEXPLEN    11
  60. #define _FEXPLEN    8
  61. #define _HIDDENBIT  1
  62. #define DMINEXP     (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3))
  63. #define FMINEXP     (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3))
  64. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  65. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  66.  
  67. #elif defined(sony) 
  68. #define MAXDOUBLE   1.79769313486231470e+308
  69. #define MAXFLOAT    ((float)3.40282346638528860e+38)
  70. #define MINDOUBLE   2.2250738585072010e-308
  71. #define MINFLOAT    ((float)1.17549435e-38)
  72. #define _IEEE       1
  73. #define _DEXPLEN    11
  74. #define _FEXPLEN    8
  75. #define _HIDDENBIT  1
  76. #define DMINEXP     (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3))
  77. #define FMINEXP     (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3))
  78. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  79. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  80.  
  81. #elif defined(sequent)
  82. extern double _maxdouble, _mindouble;
  83. extern float _maxfloat, _minfloat;
  84. #define MAXDOUBLE       _maxdouble
  85. #define MAXFLOAT        _maxfloat
  86. #define MINDOUBLE       _mindouble
  87. #define MINFLOAT        _minfloat
  88. #define _IEEE       1
  89. #define _DEXPLEN    11
  90. #define _FEXPLEN    8
  91. #define _HIDDENBIT  1
  92. #define DMINEXP     (-(DMAXEXP - 3))
  93. #define FMINEXP     (-(FMAXEXP - 3))
  94. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  95. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  96.  
  97. #elif defined(i386)
  98. #define MAXDOUBLE   1.79769313486231570e+308
  99. #define MAXFLOAT    ((float)3.40282346638528860e+38)
  100. #define MINDOUBLE   2.22507385850720140e-308
  101. #define MINFLOAT    ((float)1.17549435082228750e-38)
  102. #define _IEEE       0
  103. #define _DEXPLEN    11
  104. #define _FEXPLEN    8
  105. #define _HIDDENBIT  1
  106. #define DMINEXP     (-DMAXEXP)
  107. #define FMINEXP     (-FMAXEXP)
  108. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  109. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  110.  
  111. /* from Andrew Klossner <andrew%frip.wv.tek.com@relay.cs.net> */
  112. #elif defined(m88k)
  113.         /* These are "good" guesses ...
  114.            I'll figure out the true mins and maxes later, at the time I find
  115.            out the mins and maxes that the compiler can tokenize. */
  116. #define MAXDOUBLE   1.79769313486231e+308
  117. #define MAXFLOAT    ((float)3.40282346638528e+38)
  118. #define MINDOUBLE   2.22507385850720e-308
  119. #define MINFLOAT    ((float)1.17549435082228e-38)
  120. #define _IEEE       1
  121. #define _DEXPLEN    11
  122. #define _FEXPLEN    8
  123. #define _HIDDENBIT  1
  124. #define DMINEXP     (1-DMAXEXP)
  125. #define FMINEXP     (1-FMAXEXP)
  126. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  127. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  128.  
  129. #elif defined(convex)
  130. #define MAXDOUBLE   8.9884656743115785e+306
  131. #define MAXFLOAT    ((float) 1.70141173e+38)
  132. #define MINDOUBLE   5.5626846462680035e-308
  133. #define MINFLOAT    ((float) 2.93873588e-39)
  134. #define _IEEE       0
  135. #define _DEXPLEN    11
  136. #define _FEXPLEN    8
  137. #define _HIDDENBIT  1
  138. #define DMINEXP     (-DMAXEXP)
  139. #define FMINEXP     (-FMAXEXP)
  140. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  141. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  142.  
  143. /* #elif defined(vax)   */
  144. /* use vax versions by default -- they seem to be the most conservative */
  145. #else 
  146.  
  147. #define MAXDOUBLE   1.701411834604692293e+38
  148. #define MINDOUBLE   (2.938735877055718770e-39)
  149.  
  150. #define MAXFLOAT    1.7014117331926443e+38
  151. #define MINFLOAT    2.9387358770557188e-39
  152.  
  153. #define _IEEE       0
  154. #define _DEXPLEN    8
  155. #define _FEXPLEN    8
  156. #define _HIDDENBIT  1
  157. #define DMINEXP     (-DMAXEXP)
  158. #define FMINEXP     (-FMAXEXP)
  159. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  160. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  161. #endif
  162.  
  163. #define DSIGNIF     (DOUBLEBITS - _DEXPLEN + _HIDDENBIT - 1)
  164. #define FSIGNIF     (FLOATBITS  - _FEXPLEN + _HIDDENBIT - 1)
  165. #define DMAXPOWTWO  ((double)(1L << LONGBITS -2)*(1L << DSIGNIF - LONGBITS +1))
  166. #define FMAXPOWTWO  ((float)(1L << FSIGNIF - 1))
  167.  
  168. #endif
  169.  
  170.