home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / d / libc / libc-4.6 / libc-4 / libc-linux / misc / soft.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-18  |  1.5 KB  |  65 lines

  1. #ifndef __SOFT_H
  2. #define __SOFT_H
  3.  
  4. #ifndef __LIBRARY__
  5. #define __LIBRARY__
  6. #endif
  7.  
  8. #include <math.h>
  9. #include <errno.h>
  10. #include <endian.h>
  11.  
  12. extern int finite(double);
  13. extern double infnan(int);
  14.  
  15. extern double pio2;
  16. extern double *double_inf, *double_minf, *double_NaN;
  17. extern double *double_huge, *double_tiny;
  18. extern float *float_huge, *float_tiny;
  19.  
  20. #ifdef LITTLE_ENDIAN
  21. struct bitdouble {    /* internal format of an IEEE double */
  22.     unsigned mant2;
  23.     unsigned mant1 : 20;
  24.     unsigned exp : 11;
  25.     unsigned sign : 1;    /* 0=pos, 1=neg */
  26. };            /* value = 2^(exp-BIAS) * 0b1.|mant|mant2 */
  27.  
  28. struct bitfloat {    /* format of a float (single-precision IEEE) */
  29.     unsigned mant : 23;
  30.     unsigned exp : 8;
  31.     unsigned sign : 1;
  32. };
  33. #else
  34. struct bitdouble {    /* internal format of an IEEE double */
  35.     unsigned sign : 1;    /* 0=pos, 1=neg */
  36.     unsigned exp : 11;
  37.     unsigned mant1 : 20;
  38.     unsigned mant2;
  39. };            /* value = 2^(exp-BIAS) * 0b1.|mant|mant2 */
  40.  
  41. struct bitfloat {    /* format of a float (single-precision IEEE) */
  42.     unsigned sign : 1;
  43.     unsigned exp : 8;
  44.     unsigned mant : 23;
  45. };
  46. #endif
  47.  
  48. /* note: GNU CC floating-point constants are all treated as 'float's, 
  49.  * so loss of precision will result accordingly when using constants;
  50.  * an eventual atof() should handle full double values, with which
  51.  * HUGEDOUBLE may be used. -meg
  52.  */
  53.  
  54. #define INFINITE    (*double_inf)
  55. #define NEG_INFINITE    (*double_minf)
  56. #define NOT_A_NUMBER    (*double_NaN)
  57. #define DHUGE        (*double_huge)
  58. #define DTINY        (*double_tiny)
  59. #define FHUGE        (*float_huge)
  60. #define FTINY        (*float_tiny)
  61.  
  62. #define BIAS        0x3ff    /* added to exp of bitdouble */
  63.  
  64. #endif
  65.