home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Sound / LAME / src / ieeefloat.h < prev    next >
C/C++ Source or Header  |  2000-06-07  |  3KB  |  92 lines

  1. #ifndef IEEE_FLOAT_H__
  2. #define IEEE_FLOAT_H__
  3. /* Copyright (C) 1988-1991 Apple Computer, Inc.
  4.  * All Rights Reserved.
  5.  *
  6.  * Warranty Information
  7.  * Even though Apple has reviewed this software, Apple makes no warranty
  8.  * or representation, either express or implied, with respect to this
  9.  * software, its quality, accuracy, merchantability, or fitness for a
  10.  * particular purpose.  As a result, this software is provided "as is,"
  11.  * and you, its user, are assuming the entire risk as to its quality
  12.  * and accuracy.
  13.  *
  14.  * This code may be used and freely distributed as long as it includes
  15.  * this copyright notice and the warranty information.
  16.  *
  17.  * Machine-independent I/O routines for IEEE floating-point numbers.
  18.  *
  19.  * NaN's and infinities are converted to HUGE_VAL or HUGE, which
  20.  * happens to be infinity on IEEE machines.  Unfortunately, it is
  21.  * impossible to preserve NaN's in a machine-independent way.
  22.  * Infinities are, however, preserved on IEEE machines.
  23.  *
  24.  * These routines have been tested on the following machines:
  25.  *    Apple Macintosh, MPW 3.1 C compiler
  26.  *    Apple Macintosh, THINK C compiler
  27.  *    Silicon Graphics IRIS, MIPS compiler
  28.  *    Cray X/MP and Y/MP
  29.  *    Digital Equipment VAX
  30.  *    Sequent Balance (Multiprocesor 386)
  31.  *    NeXT
  32.  *
  33.  *
  34.  * Implemented by Malcolm Slaney and Ken Turkowski.
  35.  *
  36.  * Malcolm Slaney contributions during 1988-1990 include big- and little-
  37.  * endian file I/O, conversion to and from Motorola's extended 80-bit
  38.  * floating-point format, and conversions to and from IEEE single-
  39.  * precision floating-point format.
  40.  *
  41.  * In 1991, Ken Turkowski implemented the conversions to and from
  42.  * IEEE double-precision format, added more precision to the extended
  43.  * conversions, and accommodated conversions involving +/- infinity,
  44.  * NaN's, and denormalized numbers.
  45.  *
  46.  * $Id: ieeefloat.h,v 1.2 2000/06/07 22:56:02 sbellon Exp $
  47.  *
  48.  * $Log: ieeefloat.h,v $
  49.  * Revision 1.2  2000/06/07 22:56:02  sbellon
  50.  * added support for FPA10 hardware (RISC OS only)
  51.  *
  52.  * Revision 1.1.1.1  1999/11/24 08:42:58  markt
  53.  * initial checkin of LAME
  54.  * Starting with LAME 3.57beta with some modifications
  55.  *
  56.  * Revision 1.1  1993/06/11  17:45:46  malcolm
  57.  * Initial revision
  58.  *
  59.  */
  60.  
  61. #if defined(__riscos__) && defined(FPA10)
  62. #include    "ymath.h"
  63. #else
  64. #include    <math.h>
  65. #endif
  66.  
  67. typedef float Single;
  68.  
  69. #ifndef applec
  70.  typedef double defdouble;
  71. #else /* !applec */
  72.  typedef long double defdouble;
  73. #endif /* applec */
  74.  
  75. #ifndef THINK_C
  76.  typedef double Double;
  77. #else /* THINK_C */
  78.  typedef short double Double;
  79. #endif /* THINK_C */
  80.  
  81. #define    kFloatLength    4
  82. #define    kDoubleLength    8
  83. #define    kExtendedLength    10
  84.  
  85. extern defdouble ConvertFromIeeeSingle(char *bytes);
  86. extern void ConvertToIeeeSingle(defdouble num, char *bytes);
  87. extern defdouble ConvertFromIeeeDouble(char *bytes);
  88. extern void ConvertToIeeeDouble(defdouble num, char *bytes);
  89. extern defdouble ConvertFromIeeeExtended(char *bytes);
  90. extern void ConvertToIeeeExtended(defdouble num, char *bytes);
  91. #endif
  92.