summaryrefslogtreecommitdiff
path: root/v4.0/src/TOOLS/BLD/INC/FLOAT.H
blob: 2d73f85f71dd182ff50edff6de91d574442a9ace (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/***
*float.h - constants for floating point values
*
*   Copyright (c) 1985-1988, Microsoft Corporation.  All rights reserved.
*
*Purpose:
*   This file contains defines for a number of implementation dependent
*   values which are commonly used by sophisticated numerical (floating
*   point) programs.
*   [ANSI]
*
*******************************************************************************/


#ifndef NO_EXT_KEYS /* extensions enabled */
    #define _CDECL  cdecl
#else /* extensions not enabled */
    #define _CDECL
#endif /* NO_EXT_KEYS */

#define DBL_DIG         15                      /* # of decimal digits of precision */
#define DBL_EPSILON     2.2204460492503131e-016 /* smallest such that 1.0+DBL_EPSILON != 1.0 */
#define DBL_MANT_DIG    53                      /* # of bits in mantissa */
#define DBL_MAX         1.7976931348623158e+308 /* max value */
#define DBL_MAX_10_EXP  308                     /* max decimal exponent */
#define DBL_MAX_EXP     1024                    /* max binary exponent */
#define DBL_MIN         2.2250738585072014e-308 /* min positive value */
#define DBL_MIN_10_EXP  -307                    /* min decimal exponent
#define DBL_MIN_EXP     -1021                   /* min binary exponent */
#define DBL_RADIX       2                       /* exponent radix */
#define DBL_ROUNDS      0                       /* addition rounding: chops */

#define FLT_DIG         6                       /* # of decimal digits of precision */
#define FLT_EPSILON     1.192092896e-07         /* smallest such that 1.0+FLT_EPSILON != 1.0 */
#define FLT_GUARD       0
#define FLT_MANT_DIG    24                      /* # of bits in mantissa */
#define FLT_MAX         3.402823466e+38         /* max value */
#define FLT_MAX_10_EXP  38                      /* max decimal exponent */
#define FLT_MAX_EXP     128                     /* max binary exponent */
#define FLT_MIN         1.175494351e-38         /* min positive value */
#define FLT_MIN_10_EXP  -37                     /* min decimal exponent */
#define FLT_MIN_EXP     -125                    /* min binary exponent */
#define FLT_NORMALIZE   0
#define FLT_RADIX       2                       /* exponent radix */
#define FLT_ROUNDS      0                       /* addition rounding: chops */

#define LDBL_DIG        DBL_DIG                 /* # of decimal digits of precision */
#define LDBL_EPSILON    DBL_EPSILON             /* smallest such that 1.0+LDBL_EPSILON != 1.0 */
#define LDBL_MANT_DIG   DBL_MANT_DIG            /* # of bits in mantissa */
#define LDBL_MAX        DBL_MAX                 /* max value */
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP          /* max decimal exponent */
#define LDBL_MAX_EXP    DBL_MAX_EXP             /* max binary exponent */
#define LDBL_MIN        DBL_MIN                 /* min positive value */
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP          /* min deimal exponent
#define LDBL_MIN_EXP    DBL_MIN_EXP             /* min binary exponent */
#define LDBL_RADIX      DBL_RADIX               /* exponent radix */
#define LDBL_ROUNDS     DBL_ROUNDS              /* addition rounding: chops */


/*
 *  8087/80287 math control information
 */


/* User Control Word Mask and bit definitions.
 * These definitions match the 8087/80287
 */

#define     MCW_EM          0x003f      /* interrupt Exception Masks */
#define     EM_INVALID      0x0001      /*   invalid */
#define     EM_DENORMAL     0x0002      /*   denormal */
#define     EM_ZERODIVIDE   0x0004      /*   zero divide */
#define     EM_OVERFLOW     0x0008      /*   overflow */
#define     EM_UNDERFLOW    0x0010      /*   underflow */
#define     EM_INEXACT      0x0020      /*   inexact (precision) */

#define     MCW_IC          0x1000      /* Infinity Control */
#define     IC_AFFINE       0x1000      /*   affine */
#define     IC_PROJECTIVE   0x0000      /*   projective */

#define     MCW_RC          0x0c00      /* Rounding Control */
#define     RC_CHOP         0x0c00      /*   chop */
#define     RC_UP           0x0800      /*   up */
#define     RC_DOWN         0x0400      /*   down */
#define     RC_NEAR         0x0000      /*   near */

#define     MCW_PC          0x0300      /* Precision Control */
#define     PC_24           0x0000      /*    24 bits */
#define     PC_53           0x0200      /*    53 bits */
#define     PC_64           0x0300      /*    64 bits */


/* initial Control Word value */

#define CW_DEFAULT ( IC_AFFINE + RC_NEAR + PC_64 + EM_DENORMAL + EM_UNDERFLOW + EM_INEXACT )


/* user Status Word bit definitions */

#define SW_INVALID          0x0001      /*   invalid */
#define SW_DENORMAL         0x0002      /*   denormal */
#define SW_ZERODIVIDE       0x0004      /*   zero divide */
#define SW_OVERFLOW         0x0008      /*   overflow */
#define SW_UNDERFLOW        0x0010      /*   underflow */
#define SW_INEXACT          0x0020      /*   inexact (precision) */


/* invalid subconditions (SW_INVALID also set) */

#define SW_UNEMULATED       0x0040      /* unemulated instruction */
#define SW_SQRTNEG          0x0080      /* square root of a neg number */
#define SW_STACKOVERFLOW    0x0200      /* FP stack overflow */
#define SW_STACKUNDERFLOW   0x0400      /* FP stack underflow */


/*  Floating point error signals and return codes */

#define FPE_INVALID         0x81
#define FPE_DENORMAL        0x82
#define FPE_ZERODIVIDE      0x83
#define FPE_OVERFLOW        0x84
#define FPE_UNDERFLOW       0x85
#define FPE_INEXACT         0x86

#define FPE_UNEMULATED      0x87
#define FPE_SQRTNEG         0x88
#define FPE_STACKOVERFLOW   0x8a
#define FPE_STACKUNDERFLOW  0x8b

#define FPE_EXPLICITGEN     0x8c    /* raise( SIGFPE ); */

/* function prototypes */

unsigned int _CDECL _clear87(void);
unsigned int _CDECL _control87(unsigned int,unsigned int);
void _CDECL _fpreset(void);
unsigned int _CDECL _status87(void);