home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / armlinux / alpha / PARTITIONS / USR_GZ / usr / include / ieee754.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-14  |  1.8 KB  |  70 lines

  1. /* Copyright (C) 1992 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef _IEEE754_H
  20. #define _IEEE754_H
  21.  
  22. #include <endian.h>
  23.  
  24. union ieee754_double
  25.   {
  26.     double d;
  27.     
  28.     /* This is the IEEE 754 double-precision format.  */
  29.     struct
  30.       {
  31. #if    __BYTE_ORDER == __BIG_ENDIAN
  32.     unsigned int negative:1;
  33.     unsigned int exponent:11;
  34.     /* Together these comprise the mantissa.  */
  35.     unsigned int mantissa0:20;
  36.     unsigned int mantissa1:32;
  37. #endif
  38. #if    __BYTE_ORDER == __LITTLE_ENDIAN
  39.     /* Together these comprise the mantissa.  */
  40.     unsigned int mantissa1:32;
  41.     unsigned int mantissa0:20;
  42.     unsigned int exponent:11;
  43.     unsigned int negative:1;
  44. #endif
  45.       } ieee;
  46.   };
  47.  
  48. #define _IEEE754_DOUBLE_BIAS            0x3ff   /* added to exp of ieee754_double */
  49.  
  50. #ifdef __i386__
  51.  
  52. union i387_float
  53.   {
  54.     float f;
  55.     
  56.     /* This is the i387 single-precision format.  */
  57.     struct
  58.       {
  59.     unsigned int mantissa:23;
  60.     unsigned int exponent:8;
  61.     unsigned int negative:1;
  62.       } i387;
  63.   };
  64.  
  65. #define _I387_FLOAT_BIAS            0x7f   /* added to exp of i387_float */
  66.  
  67. #endif /* __i387__ */
  68.  
  69. #endif    /* _IEEE754_H */
  70.