2 * Floating point arithmetic.
4 * Derived from the mingw header written by Colin Peters.
5 * Modified for Wine use by Hans Leidekker.
6 * This file is in the public domain.
10 #define __WINE_FLOAT_H
19 #define DBL_EPSILON 2.2204460492503131e-016
20 #define DBL_MANT_DIG 53
21 #define DBL_MAX 1.7976931348623158e+308
22 #define DBL_MAX_10_EXP 308
23 #define DBL_MAX_EXP 1024
24 #define DBL_MIN 2.2250738585072014e-308
25 #define DBL_MIN_10_EXP (-307)
26 #define DBL_MIN_EXP (-1021)
31 #define DBL_RADIX _DBL_RADIX
32 #define DBL_ROUNDS _DBL_ROUNDS
35 #define FLT_EPSILON 1.192092896e-07F
36 #define FLT_MANT_DIG 24
37 #define FLT_MAX 3.402823466e+38F
38 #define FLT_MAX_10_EXP 38
39 #define FLT_MAX_EXP 128
40 #define FLT_MIN 1.175494351e-38F
41 #define FLT_MIN_10_EXP (-37)
42 #define FLT_MIN_EXP (-125)
47 #define LDBL_DIG DBL_DIG
48 #define LDBL_EPSILON DBL_EPSILON
49 #define LDBL_MANT_DIG DBL_MANT_DIG
50 #define LDBL_MAX DBL_MAX
51 #define LDBL_MAX_10_EXP DBL_MAX_10_EXP
52 #define LDBL_MAX_EXP DBL_MAX_EXP
53 #define LDBL_MIN DBL_MIN
54 #define LDBL_MIN_10_EXP DBL_MIN_10_EXP
55 #define LDBL_MIN_EXP DBL_MIN_EXP
57 #define _LDBL_RADIX _DBL_RADIX
58 #define _LDBL_ROUNDS _DBL_ROUNDS
60 #define LDBL_RADIX _LDBL_RADIX
61 #define LDBL_ROUNDS _LDBL_ROUNDS
63 /* Control word masks for unMask */
64 #define _MCW_EM 0x0008001f
65 #define _MCW_IC 0x00040000
66 #define _MCW_RC 0x00000300
67 #define _MCW_PC 0x00030000
68 #define _MCW_DN 0x03000000
70 /* Control word values for unNew (use with related unMask above) */
71 #define _EM_INVALID 0x00000010
72 #define _EM_DENORMAL 0x00080000
73 #define _EM_ZERODIVIDE 0x00000008
74 #define _EM_OVERFLOW 0x00000004
75 #define _EM_UNDERFLOW 0x00000002
76 #define _EM_INEXACT 0x00000001
77 #define _IC_AFFINE 0x00040000
78 #define _IC_PROJECTIVE 0x00000000
79 #define _RC_CHOP 0x00000300
80 #define _RC_UP 0x00000200
81 #define _RC_DOWN 0x00000100
82 #define _RC_NEAR 0x00000000
83 #define _PC_24 0x00020000
84 #define _PC_53 0x00010000
85 #define _PC_64 0x00000000
86 #define _DN_SAVE 0x00000000
87 #define _DN_FLUSH 0x01000000
88 #define _DN_FLUSH_OPERANDS_SAVE_RESULTS 0x02000000
89 #define _DN_SAVE_OPERANDS_FLUSH_RESULTS 0x03000000
90 #define _EM_AMBIGUOUS 0x80000000
92 /* _statusfp bit flags */
93 #define _SW_INEXACT 0x00000001 /* inexact (precision) */
94 #define _SW_UNDERFLOW 0x00000002 /* underflow */
95 #define _SW_OVERFLOW 0x00000004 /* overflow */
96 #define _SW_ZERODIVIDE 0x00000008 /* zero divide */
97 #define _SW_INVALID 0x00000010 /* invalid */
99 #define _SW_UNEMULATED 0x00000040 /* unemulated instruction */
100 #define _SW_SQRTNEG 0x00000080 /* square root of a neg number */
101 #define _SW_STACKOVERFLOW 0x00000200 /* FP stack overflow */
102 #define _SW_STACKUNDERFLOW 0x00000400 /* FP stack underflow */
104 #define _SW_DENORMAL 0x00080000 /* denormal status bit */
106 /* fpclass constants */
107 #define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */
108 #define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */
109 #define _FPCLASS_NINF 0x0004 /* Negative Infinity */
110 #define _FPCLASS_NN 0x0008 /* Negative Normal */
111 #define _FPCLASS_ND 0x0010 /* Negative Denormal */
112 #define _FPCLASS_NZ 0x0020 /* Negative Zero */
113 #define _FPCLASS_PZ 0x0040 /* Positive Zero */
114 #define _FPCLASS_PD 0x0080 /* Positive Denormal */
115 #define _FPCLASS_PN 0x0100 /* Positive Normal */
116 #define _FPCLASS_PINF 0x0200 /* Positive Infinity */
118 /* floating point error signals */
119 #define _FPE_INVALID 0x81
120 #define _FPE_DENORMAL 0x82
121 #define _FPE_ZERODIVIDE 0x83
122 #define _FPE_OVERFLOW 0x84
123 #define _FPE_UNDERFLOW 0x85
124 #define _FPE_INEXACT 0x86
125 #define _FPE_UNEMULATED 0x87
126 #define _FPE_SQRTNEG 0x88
127 #define _FPE_STACKOVERFLOW 0x8a
128 #define _FPE_STACKUNDERFLOW 0x8b
129 #define _FPE_EXPLICITGEN 0x8c
131 #if defined(__i386__)
132 #define _CW_DEFAULT (_RC_NEAR + _PC_53 + _EM_INVALID + _EM_ZERODIVIDE + _EM_OVERFLOW + _EM_UNDERFLOW + _EM_INEXACT + _EM_DENORMAL)
133 #elif defined(__x86_64__)
134 #define _CW_DEFAULT (_RC_NEAR + _PC_64 + _EM_INVALID + _EM_ZERODIVIDE + _EM_OVERFLOW + _EM_UNDERFLOW + _EM_INEXACT + _EM_DENORMAL)
137 _ACRTIMP
unsigned int __cdecl
_clearfp(void);
138 _ACRTIMP
unsigned int __cdecl
_statusfp(void);
139 _ACRTIMP
int __cdecl
__fpe_flt_rounds(void);
140 _ACRTIMP
unsigned int __cdecl
_control87(unsigned int, unsigned int);
141 _ACRTIMP
unsigned int __cdecl
_controlfp(unsigned int, unsigned int);
142 _ACRTIMP errno_t __cdecl
_controlfp_s(unsigned int *, unsigned int, unsigned int);
144 _ACRTIMP
int __cdecl
__control87_2(unsigned int, unsigned int, unsigned int *, unsigned int *);
147 _ACRTIMP
double __cdecl
_copysign (double, double);
148 _ACRTIMP
double __cdecl
_chgsign (double);
149 _ACRTIMP
double __cdecl
_scalb(double, __msvcrt_long
);
150 _ACRTIMP
double __cdecl
_logb(double);
151 _ACRTIMP
double __cdecl
_nextafter(double, double);
152 _ACRTIMP
int __cdecl
_finite(double);
153 _ACRTIMP
int __cdecl
_isnan(double);
154 _ACRTIMP
int __cdecl
_fpclass(double);
157 _ACRTIMP
float __cdecl
_scalbf(float, __msvcrt_long
);
164 #endif /* __WINE_FLOAT_H */