OSDN Git Service

If HAVE_SHARED is disabled and libm/TARGET_ARCH does not exist, subdirs does not...
[uclinux-h8/uClibc.git] / libm / fp_private.h
1 /*******************************************************************************
2 *                                                                              *
3 *      File fp_private.h,                                                      *
4 *      All pack 4 dependencies for the MathLib elems plus some defines used    *
5 *      throughout MathLib.                                                     *
6 *                                                                              *
7 *      Copyright © 1991 Apple Computer, Inc.  All rights reserved.             *
8 *                                                                              *
9 *      Written by Ali Sazegari, started on October 1991,                       *
10 *                                                                              *
11 *      W A R N I N G:  This routine expects a 64 bit double model.             *
12 *                                                                              *
13 *******************************************************************************/
14
15 #define      NoException            0
16
17 /*******************************************************************************
18 *                              Values of constants.                            *
19 *******************************************************************************/
20
21 //#define    SgnMask            0x8000
22 #define      dSgnMask           0x80000000
23 #define      sSgnMask           0x7FFFFFFF
24
25 //#define    ExpMask            0x7FFF
26 #define      dExpMask           0x7FF00000
27 #define      sExpMask           0xFF000000
28
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.  */
32 #define      InfExp            0x7FF
33 #define      dMaxExp           0x7FF00000
34
35 #define      MaxExpP1          1024
36 #define      MaxExp            1023
37
38 #define      DenormLimit       -52
39
40 //#define    ManMask           0x80000000
41 #define      dManMask          0x00080000
42
43 //#define    IsItDenorm         0x80000000
44 #define      dIsItDenorm        0x00080000
45
46 //#define    xIsItSNaN          0x40000000
47 #define      dIsItSNaN          0x00080000
48
49 #define      dHighMan           0x000FFFFF
50 #define      dFirstBitSet       0x00080000
51 #define      BIAS               0x3FF
52
53 //#define    GetSign            0x8000
54 #define      dGetSign           0x80000000
55 #define      sGetSign           0x80000000
56
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
60
61 //#define    Exponent(x)       x.hex.exponent & ExpMask
62 #define      dExponent(x)      x.hex.high & dExpMask
63 #define      sExponent(x)      ( ( x.hexsgl << 1 ) & sExpMask )
64
65 #define      sZero(x)          ( x.hexsgl & sSgnMask ) == 0
66 //#define    Sign(x)           ( x.hex.exponent & SgnMask ) == SgnMask
67
68 /*******************************************************************************
69 *                        Types used in the auxiliary functions.                *
70 *******************************************************************************/
71
72 #include <stdint.h>
73
74 typedef struct                   /*      Hex representation of a double.      */
75       {
76 #if defined(__BIG_ENDIAN__)
77       uint32_t high;
78       uint32_t low;
79 #else
80       uint32_t low;
81       uint32_t high;
82 #endif
83       } dHexParts;
84
85 typedef union
86       {
87       unsigned char byties[8];
88       double dbl;
89       } DblInHex;