home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / g__lib / values.h < prev    next >
C/C++ Source or Header  |  1993-07-23  |  4KB  |  117 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /* 
  3. Copyright (C) 1988 Free Software Foundation
  4.     written by Doug Lea (dl@rocky.oswego.edu)
  5.  
  6. This file is part of GNU CC.
  7.  
  8. GNU CC is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY.  No author or distributor
  10. accepts responsibility to anyone for the consequences of using it
  11. or for whether it serves any particular purpose or works at all,
  12. unless he says so in writing.  Refer to the GNU CC General Public
  13. License for full details.
  14.  
  15. Everyone is granted permission to copy, modify and redistribute
  16. GNU CC, but only under the conditions described in the
  17. GNU CC General Public License.   A copy of this license is
  18. supposed to have been given to you along with GNU CC so you
  19. can know your rights and responsibilities.  It should be in a
  20. file named COPYING.  Among other things, the copyright notice
  21. and this notice must be preserved on all copies.  
  22. */
  23.  
  24.  
  25. #ifndef _values_h
  26. #pragma once
  27. #define _values_h 1
  28.  
  29. #define BITSPERBYTE 8
  30. #define BITS(type)  (BITSPERBYTE * (int)sizeof(type))
  31.  
  32. #define CHARBITS    BITS(char)
  33. #define SHORTBITS   BITS(short)
  34. #define INTBITS     BITS(int)
  35. #define LONGBITS    BITS(long)
  36. #define PTRBITS     BITS(char*)
  37. #define DOUBLEBITS  BITS(double)
  38. #define FLOATBITS   BITS(float)
  39.  
  40. #define MINSHORT    ((short)(1 << (SHORTBITS - 1)))
  41. #define MININT      (1 << (INTBITS - 1))
  42. #define MINLONG     (1L << (LONGBITS - 1))
  43.  
  44. #define MAXSHORT    ((short)~MINSHORT)
  45. #define MAXINT      (~MININT)
  46. #define MAXLONG     (~MINLONG)
  47.  
  48. #if defined(sun)
  49. #define MAXDOUBLE   1.79769313486231470e+308
  50. #define MAXFLOAT    ((float)3.40282346638528860e+38)
  51. #define MINDOUBLE   4.94065645841246544e-324
  52. #define MINFLOAT    ((float)1.40129846432481707e-45)
  53. #define _IEEE       1
  54. #define _DEXPLEN    11
  55. #define _FEXPLEN    8
  56. #define _HIDDENBIT  1
  57. #define DMINEXP     (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3))
  58. #define FMINEXP     (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3))
  59. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  60. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  61.  
  62. #elif defined(sequent)
  63. extern double _maxdouble, _mindouble;
  64. extern float _maxfloat, _minfloat;
  65. #define MAXDOUBLE    _maxdouble
  66. #define MAXFLOAT    _maxfloat
  67. #define MINDOUBLE    _mindouble
  68. #define MINFLOAT    _minfloat
  69. #define _IEEE       1
  70. #define _DEXPLEN    11
  71. #define _FEXPLEN    8
  72. #define _HIDDENBIT  1
  73. #define DMINEXP     (-(DMAXEXP - 3))
  74. #define FMINEXP     (-(FMAXEXP - 3))
  75. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  76. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  77.  
  78. #elif defined(i386)
  79. #define MAXDOUBLE   1.79769313486231570e+308
  80. #define MAXFLOAT    3.40282346638528860e+38
  81. #define MINDOUBLE   2.22507385850720140e-308
  82. #define MINFLOAT    1.17549435082228750e-38
  83. #define _IEEE       0
  84. #define _DEXPLEN    11
  85. #define _FEXPLEN    8
  86. #define _HIDDENBIT  1
  87. #define DMINEXP     (-DMAXEXP)
  88. #define FMINEXP     (-FMAXEXP)
  89. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  90. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  91.  
  92.  
  93. // #elif defined(vax)
  94. // use vax versions by default -- they seem to be the most conservative
  95. #else 
  96. #define MAXDOUBLE   1.701411834604692293e+38
  97. #define MAXFLOAT    ((float)MAXDOUBLE)
  98. #define MINDOUBLE   (2.938735877055718770e-39)
  99. #define MINFLOAT    ((float)MINDOUBLE)
  100. #define _IEEE       0
  101. #define _DEXPLEN    8
  102. #define _FEXPLEN    8
  103. #define _HIDDENBIT  1
  104. #define DMINEXP     (-DMAXEXP)
  105. #define FMINEXP     (-FMAXEXP)
  106. #define DMAXEXP     ((1 << _DEXPLEN - 1) - 1 + _IEEE)
  107. #define FMAXEXP     ((1 << _FEXPLEN - 1) - 1 + _IEEE)
  108. #endif
  109.  
  110. #define DSIGNIF     (DOUBLEBITS - _DEXPLEN + _HIDDENBIT - 1)
  111. #define FSIGNIF     (FLOATBITS  - _FEXPLEN + _HIDDENBIT - 1)
  112. #define DMAXPOWTWO  ((double)(1L << LONGBITS -2)*(1L << DSIGNIF - LONGBITS +1))
  113. #define FMAXPOWTWO  ((float)(1L << FSIGNIF - 1))
  114.  
  115. #endif
  116.  
  117.