home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / djgpp / include / values.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-20  |  5.8 KB  |  171 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. #pragma once
  33. #define _values_h 1
  34.  
  35. #define BITSPERBYTE 8
  36. #define BITS(type)  (BITSPERBYTE * (int)sizeof(type))
  37.  
  38. #define CHARBITS    BITS(char)
  39. #define SHORTBITS   BITS(short)
  40. #define INTBITS     BITS(int)
  41. #define LONGBITS    BITS(long)
  42. #define PTRBITS     BITS(char*)
  43. #define DOUBLEBITS  BITS(double)
  44. #define FLOATBITS   BITS(float)
  45.  
  46. #define MINSHORT    ((short)(1 << (SHORTBITS - 1)))
  47. #define MININT      (1 << (INTBITS - 1))
  48. #define MINLONG     (1L << (LONGBITS - 1))
  49.  
  50. #define MAXSHORT    ((short)~MINSHORT)
  51. #define MAXINT      (~MININT)
  52. #define MAXLONG     (~MINLONG)
  53.  
  54. #if defined(sun) || defined(hp300) || defined(hpux)
  55. #define MAXDOUBLE   1.79769313486231470e+308
  56. #define MAXFLOAT    ((float)3.40282346638528860e+38)
  57. #define MINDOUBLE   4.94065645841246544e-324
  58. #define MINFLOAT    ((float)1.40129846432481707e-45)
  59. #define _IEEE       1
  60. #define _DEXPLEN    11
  61. #define _FEXPLEN    8
  62. #define _HIDDENBIT  1
  63. #define DMINEXP     (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3))
  64. #define FMINEXP     (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3))
  65. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  66. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  67.  
  68. #elif defined(sony) 
  69. #define MAXDOUBLE   1.79769313486231470e+308
  70. #define MAXFLOAT    ((float)3.40282346638528860e+38)
  71. #define MINDOUBLE   2.2250738585072010e-308
  72. #define MINFLOAT    ((float)1.17549435e-38)
  73. #define _IEEE       1
  74. #define _DEXPLEN    11
  75. #define _FEXPLEN    8
  76. #define _HIDDENBIT  1
  77. #define DMINEXP     (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3))
  78. #define FMINEXP     (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3))
  79. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  80. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  81.  
  82. #elif defined(sequent)
  83. extern double _maxdouble, _mindouble;
  84. extern float _maxfloat, _minfloat;
  85. #define MAXDOUBLE    _maxdouble
  86. #define MAXFLOAT    _maxfloat
  87. #define MINDOUBLE    _mindouble
  88. #define MINFLOAT    _minfloat
  89. #define _IEEE       1
  90. #define _DEXPLEN    11
  91. #define _FEXPLEN    8
  92. #define _HIDDENBIT  1
  93. #define DMINEXP     (-(DMAXEXP - 3))
  94. #define FMINEXP     (-(FMAXEXP - 3))
  95. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  96. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  97.  
  98. #elif defined(i386)
  99. #define MAXDOUBLE   1.79769313486231570e+308
  100. #define MAXFLOAT    ((float)3.40282346638528860e+38)
  101. #define MINDOUBLE   2.22507385850720140e-308
  102. #define MINFLOAT    ((float)1.17549435082228750e-38)
  103. #define _IEEE       0
  104. #define _DEXPLEN    11
  105. #define _FEXPLEN    8
  106. #define _HIDDENBIT  1
  107. #define DMINEXP     (-DMAXEXP)
  108. #define FMINEXP     (-FMAXEXP)
  109. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  110. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  111.  
  112. /* from Andrew Klossner <andrew%frip.wv.tek.com@relay.cs.net> */
  113. #elif defined(m88k)
  114.     /* These are "good" guesses ...
  115.        I'll figure out the true mins and maxes later, at the time I find
  116.        out the mins and maxes that the compiler can tokenize. */
  117. #define MAXDOUBLE   1.79769313486231e+308
  118. #define MAXFLOAT    ((float)3.40282346638528e+38)
  119. #define MINDOUBLE   2.22507385850720e-308
  120. #define MINFLOAT    ((float)1.17549435082228e-38)
  121. #define _IEEE       1
  122. #define _DEXPLEN    11
  123. #define _FEXPLEN    8
  124. #define _HIDDENBIT  1
  125. #define DMINEXP     (1-DMAXEXP)
  126. #define FMINEXP     (1-FMAXEXP)
  127. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  128. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  129.  
  130. #elif defined(convex)
  131. #define MAXDOUBLE   8.9884656743115785e+306
  132. #define MAXFLOAT    ((float) 1.70141173e+38)
  133. #define MINDOUBLE   5.5626846462680035e-308
  134. #define MINFLOAT    ((float) 2.93873588e-39)
  135. #define _IEEE       0
  136. #define _DEXPLEN    11
  137. #define _FEXPLEN    8
  138. #define _HIDDENBIT  1
  139. #define DMINEXP     (-DMAXEXP)
  140. #define FMINEXP     (-FMAXEXP)
  141. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  142. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  143.  
  144. /* #elif defined(vax)   */
  145. /* use vax versions by default -- they seem to be the most conservative */
  146. #else 
  147.  
  148. #define MAXDOUBLE   1.701411834604692293e+38
  149. #define MINDOUBLE   (2.938735877055718770e-39)
  150.  
  151. #define MAXFLOAT    1.7014117331926443e+38
  152. #define MINFLOAT    2.9387358770557188e-39
  153.  
  154. #define _IEEE       0
  155. #define _DEXPLEN    8
  156. #define _FEXPLEN    8
  157. #define _HIDDENBIT  1
  158. #define DMINEXP     (-DMAXEXP)
  159. #define FMINEXP     (-FMAXEXP)
  160. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  161. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  162. #endif
  163.  
  164. #define DSIGNIF     (DOUBLEBITS - _DEXPLEN + _HIDDENBIT - 1)
  165. #define FSIGNIF     (FLOATBITS  - _FEXPLEN + _HIDDENBIT - 1)
  166. #define DMAXPOWTWO  ((double)(1L << LONGBITS -2)*(1L << DSIGNIF - LONGBITS +1))
  167. #define FMAXPOWTWO  ((float)(1L << FSIGNIF - 1))
  168.  
  169. #endif
  170.  
  171.