1 /*******************************************************************************
4 * All pack 4 dependencies for the MathLib elems plus some defines used *
5 * throughout MathLib. *
7 * Copyright © 1991 Apple Computer, Inc. All rights reserved. *
9 * Written by Ali Sazegari, started on October 1991, *
11 * W A R N I N G: This routine expects a 64 bit double model. *
13 *******************************************************************************/
17 /*******************************************************************************
18 * Values of constants. *
19 *******************************************************************************/
21 //#define SgnMask 0x8000
22 #define dSgnMask 0x80000000
23 #define sSgnMask 0x7FFFFFFF
25 //#define ExpMask 0x7FFF
26 #define dExpMask 0x7FF00000
27 #define sExpMask 0xFF000000
29 /* according to rounding BIG & SMALL are: */
30 #define BIG 1.1e+300 /* used to deliver ±° or largest number, */
31 #define SMALL 1.1e-300 /* used to deliver ±0 or smallest number. */
33 #define dMaxExp 0x7FF00000
38 #define DenormLimit -52
40 //#define ManMask 0x80000000
41 #define dManMask 0x00080000
43 //#define IsItDenorm 0x80000000
44 #define dIsItDenorm 0x00080000
46 //#define xIsItSNaN 0x40000000
47 #define dIsItSNaN 0x00080000
49 #define dHighMan 0x000FFFFF
50 #define dFirstBitSet 0x00080000
53 //#define GetSign 0x8000
54 #define dGetSign 0x80000000
55 #define sGetSign 0x80000000
57 //#define Infinity(x) ( x.hex.exponent & ExpMask ) == ExpMask
58 #define dInfinity(x) ( x.hex.high & dExpMask ) == dExpMask
59 #define sInfinity(x) ( ( x.hexsgl << 1 ) & sExpMask ) == sExpMask
61 //#define Exponent(x) x.hex.exponent & ExpMask
62 #define dExponent(x) x.hex.high & dExpMask
63 #define sExponent(x) ( ( x.hexsgl << 1 ) & sExpMask )
65 #define sZero(x) ( x.hexsgl & sSgnMask ) == 0
66 //#define Sign(x) ( x.hex.exponent & SgnMask ) == SgnMask
68 /*******************************************************************************
69 * Types used in the auxiliary functions. *
70 *******************************************************************************/
74 typedef struct /* Hex representation of a double. */
76 #if defined(__BIG_ENDIAN__)
87 unsigned char byties[8];