00001 #ifndef IEEE_FLOAT_H__ 00002 #define IEEE_FLOAT_H__ 00003 /* Copyright (C) 1988-1991 Apple Computer, Inc. 00004 * All Rights Reserved. 00005 * 00006 * Warranty Information 00007 * Even though Apple has reviewed this software, Apple makes no warranty 00008 * or representation, either express or implied, with respect to this 00009 * software, its quality, accuracy, merchantability, or fitness for a 00010 * particular purpose. As a result, this software is provided "as is," 00011 * and you, its user, are assuming the entire risk as to its quality 00012 * and accuracy. 00013 * 00014 * This code may be used and freely distributed as long as it includes 00015 * this copyright notice and the warranty information. 00016 * 00017 * Machine-independent I/O routines for IEEE FLOATing-point numbers. 00018 * 00019 * NaN's and infinities are converted to HUGE_VAL or HUGE, which 00020 * happens to be infinity on IEEE machines. Unfortunately, it is 00021 * impossible to preserve NaN's in a machine-independent way. 00022 * Infinities are, however, preserved on IEEE machines. 00023 * 00024 * These routines have been tested on the following machines: 00025 * Apple Macintosh, MPW 3.1 C compiler 00026 * Apple Macintosh, THINK C compiler 00027 * Silicon Graphics IRIS, MIPS compiler 00028 * Cray X/MP and Y/MP 00029 * Digital Equipment VAX 00030 * Sequent Balance (Multiprocesor 386) 00031 * NeXT 00032 * 00033 * 00034 * Implemented by Malcolm Slaney and Ken Turkowski. 00035 * 00036 * Malcolm Slaney contributions during 1988-1990 include big- and little- 00037 * endian file I/O, conversion to and from Motorola's extended 80-bit 00038 * FLOATing-point format, and conversions to and from IEEE single- 00039 * precision FLOATing-point format. 00040 * 00041 * In 1991, Ken Turkowski implemented the conversions to and from 00042 * IEEE double-precision format, added more precision to the extended 00043 * conversions, and accommodated conversions involving +/- infinity, 00044 * NaN's, and denormalized numbers. 00045 * 00046 * $Id: ieeefloat.h,v 1.1 2003/10/04 00:11:19 herman Exp $ 00047 * 00048 * $Log: ieeefloat.h,v $ 00049 * Revision 1.1 2003/10/04 00:11:19 herman 00050 * New file from 1.1.7 (not in 1.1.6) added from Rich's automakified src tree. 00051 * 00052 * Revision 1.1 2003/07/29 04:17:52 heroine 00053 * *** empty log message *** 00054 * 00055 * Revision 1.1 1993/06/11 17:45:46 malcolm 00056 * Initial revision 00057 * 00058 */ 00059 00060 #include <math.h> 00061 00062 typedef float Single; 00063 00064 #define kFloatLength 4 00065 #define kDoubleLength 8 00066 #define kExtendedLength 10 00067 00068 double ConvertFromIeeeExtended (char *bytes); 00069 #endif
1.5.5