Suppress noisy pointer signed-ness warnings on x86-64.
[tinycc.git] / win32 / include / float.h
bloba6fb6dbe07f20b55bcb3c697b3eac5d15d63e35a
1 /*
2 * float.h
4 * Constants related to floating point arithmetic.
6 * Also included here are some non-ANSI bits for accessing the floating
7 * point controller.
9 * NOTE: GCC provides float.h, and it is probably more accurate than this,
10 * but it doesn't include the non-standard stuff for accessing the
11 * fp controller. (TODO: Move those bits elsewhere?) Thus it is
12 * probably not a good idea to use the GCC supplied version instead
13 * of this header.
15 * This file is part of the Mingw32 package.
17 * Contributors:
18 * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
20 * THIS SOFTWARE IS NOT COPYRIGHTED
22 * This source code is offered for use in the public domain. You may
23 * use, modify or distribute it freely.
25 * This code is distributed in the hope that it will be useful but
26 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
27 * DISCLAIMED. This includes but is not limited to warranties of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
30 * $Revision: 1.2 $
31 * $Author: bellard $
32 * $Date: 2005/04/17 13:14:29 $
36 #ifndef _FLOAT_H_
37 #define _FLOAT_H_
39 /* All the headers include this file. */
40 #include <_mingw.h>
42 #define FLT_ROUNDS 1
43 #define FLT_GUARD 1
44 #define FLT_NORMALIZE 1
47 * The characteristics of float.
50 /* The radix for floating point representation. */
51 #define FLT_RADIX 2
53 /* Decimal digits of precision. */
54 #define FLT_DIG 6
56 /* Smallest number such that 1+x != 1 */
57 #define FLT_EPSILON 1.19209290e-07F
59 /* The number of base FLT_RADIX digits in the mantissa. */
60 #define FLT_MANT_DIG 24
62 /* The maximum floating point number. */
63 #define FLT_MAX 3.40282347e+38F
65 /* Maximum n such that FLT_RADIX^n - 1 is representable. */
66 #define FLT_MAX_EXP 128
68 /* Maximum n such that 10^n is representable. */
69 #define FLT_MAX_10_EXP 38
71 /* Minimum normalized floating-point number. */
72 #define FLT_MIN 1.17549435e-38F
74 /* Minimum n such that FLT_RADIX^n is a normalized number. */
75 #define FLT_MIN_EXP (-125)
77 /* Minimum n such that 10^n is a normalized number. */
78 #define FLT_MIN_10_EXP (-37)
82 * The characteristics of double.
84 #define DBL_DIG 15
85 #define DBL_EPSILON 1.1102230246251568e-16
86 #define DBL_MANT_DIG 53
87 #define DBL_MAX 1.7976931348623157e+308
88 #define DBL_MAX_EXP 1024
89 #define DBL_MAX_10_EXP 308
90 #define DBL_MIN 2.2250738585072014e-308
91 #define DBL_MIN_EXP (-1021)
92 #define DBL_MIN_10_EXP (-307)
96 * The characteristics of long double.
97 * NOTE: long double is the same as double.
99 #define LDBL_DIG 15
100 #define LDBL_EPSILON 1.1102230246251568e-16L
101 #define LDBL_MANT_DIG 53
102 #define LDBL_MAX 1.7976931348623157e+308L
103 #define LDBL_MAX_EXP 1024
104 #define LDBL_MAX_10_EXP 308
105 #define LDBL_MIN 2.2250738585072014e-308L
106 #define LDBL_MIN_EXP (-1021)
107 #define LDBL_MIN_10_EXP (-307)
111 * Functions and definitions for controlling the FPU.
113 #ifndef __STRICT_ANSI__
115 /* TODO: These constants are only valid for x86 machines */
117 /* Control word masks for unMask */
118 #define _MCW_EM 0x0008001F /* Error masks */
119 #define _MCW_IC 0x00040000 /* Infinity */
120 #define _MCW_RC 0x00000300 /* Rounding */
121 #define _MCW_PC 0x00030000 /* Precision */
123 /* Control word values for unNew (use with related unMask above) */
124 #define _EM_INVALID 0x00000010
125 #define _EM_DENORMAL 0x00080000
126 #define _EM_ZERODIVIDE 0x00000008
127 #define _EM_OVERFLOW 0x00000004
128 #define _EM_UNDERFLOW 0x00000002
129 #define _EM_INEXACT 0x00000001
130 #define _IC_AFFINE 0x00040000
131 #define _IC_PROJECTIVE 0x00000000
132 #define _RC_CHOP 0x00000300
133 #define _RC_UP 0x00000200
134 #define _RC_DOWN 0x00000100
135 #define _RC_NEAR 0x00000000
136 #define _PC_24 0x00020000
137 #define _PC_53 0x00010000
138 #define _PC_64 0x00000000
140 /* These are also defined in Mingw math.h, needed to work around
141 GCC build issues. */
142 /* Return values for fpclass. */
143 #ifndef __MINGW_FPCLASS_DEFINED
144 #define __MINGW_FPCLASS_DEFINED 1
145 #define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */
146 #define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */
147 #define _FPCLASS_NINF 0x0004 /* Negative Infinity */
148 #define _FPCLASS_NN 0x0008 /* Negative Normal */
149 #define _FPCLASS_ND 0x0010 /* Negative Denormal */
150 #define _FPCLASS_NZ 0x0020 /* Negative Zero */
151 #define _FPCLASS_PZ 0x0040 /* Positive Zero */
152 #define _FPCLASS_PD 0x0080 /* Positive Denormal */
153 #define _FPCLASS_PN 0x0100 /* Positive Normal */
154 #define _FPCLASS_PINF 0x0200 /* Positive Infinity */
155 #endif /* __MINGW_FPCLASS_DEFINED */
157 /* invalid subconditions (_SW_INVALID also set) */
158 #define _SW_UNEMULATED 0x0040 /* unemulated instruction */
159 #define _SW_SQRTNEG 0x0080 /* square root of a neg number */
160 #define _SW_STACKOVERFLOW 0x0200 /* FP stack overflow */
161 #define _SW_STACKUNDERFLOW 0x0400 /* FP stack underflow */
163 /* Floating point error signals and return codes */
164 #define _FPE_INVALID 0x81
165 #define _FPE_DENORMAL 0x82
166 #define _FPE_ZERODIVIDE 0x83
167 #define _FPE_OVERFLOW 0x84
168 #define _FPE_UNDERFLOW 0x85
169 #define _FPE_INEXACT 0x86
170 #define _FPE_UNEMULATED 0x87
171 #define _FPE_SQRTNEG 0x88
172 #define _FPE_STACKOVERFLOW 0x8a
173 #define _FPE_STACKUNDERFLOW 0x8b
174 #define _FPE_EXPLICITGEN 0x8c /* raise( SIGFPE ); */
176 #ifndef RC_INVOKED
178 #ifdef __cplusplus
179 extern "C" {
180 #endif
182 /* Set the FPU control word as cw = (cw & ~unMask) | (unNew & unMask),
183 * i.e. change the bits in unMask to have the values they have in unNew,
184 * leaving other bits unchanged. */
185 unsigned int _controlfp (unsigned int unNew, unsigned int unMask);
186 unsigned int _control87 (unsigned int unNew, unsigned int unMask);
189 unsigned int _clearfp (void); /* Clear the FPU status word */
190 unsigned int _statusfp (void); /* Report the FPU status word */
191 #define _clear87 _clearfp
192 #define _status87 _statusfp
194 void _fpreset (void); /* Reset the FPU */
195 void fpreset (void);
197 /* Global 'variable' for the current floating point error code. */
198 int * __fpecode(void);
199 #define _fpecode (*(__fpecode()))
202 * IEEE recommended functions
205 double _chgsign (double);
206 double _copysign (double, double);
207 double _logb (double);
208 double _nextafter (double, double);
209 double _scalb (double, long);
211 int _finite (double);
212 int _fpclass (double);
213 int _isnan (double);
215 #ifdef __cplusplus
217 #endif
219 #endif /* Not RC_INVOKED */
221 #endif /* Not __STRICT_ANSI__ */
223 #endif /* _FLOAT_H_ */