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.
20 #define _DOMAIN 1 /* domain error in argument */
21 #define _SING 2 /* singularity */
22 #define _OVERFLOW 3 /* range overflow */
23 #define _UNDERFLOW 4 /* range underflow */
24 #define _TLOSS 5 /* total loss of precision */
25 #define _PLOSS 6 /* partial loss of precision */
27 #ifndef _EXCEPTION_DEFINED
28 #define _EXCEPTION_DEFINED
37 #endif /* _EXCEPTION_DEFINED */
39 #ifndef _COMPLEX_DEFINED
40 #define _COMPLEX_DEFINED
43 double x
; /* Real part */
44 double y
; /* Imaginary part */
46 #endif /* _COMPLEX_DEFINED */
48 _ACRTIMP
double __cdecl
sin(double);
49 _ACRTIMP
double __cdecl
cos(double);
50 _ACRTIMP
double __cdecl
tan(double);
51 _ACRTIMP
double __cdecl
sinh(double);
52 _ACRTIMP
double __cdecl
cosh(double);
53 _ACRTIMP
double __cdecl
tanh(double);
54 _ACRTIMP
double __cdecl
asin(double);
55 _ACRTIMP
double __cdecl
acos(double);
56 _ACRTIMP
double __cdecl
atan(double);
57 _ACRTIMP
double __cdecl
atan2(double, double);
58 _ACRTIMP
double __cdecl
asinh(double);
59 _ACRTIMP
double __cdecl
acosh(double);
60 _ACRTIMP
double __cdecl
atanh(double);
61 _ACRTIMP
double __cdecl
exp(double);
62 _ACRTIMP
double __cdecl
log(double);
63 _ACRTIMP
double __cdecl
log10(double);
64 _ACRTIMP
double __cdecl
pow(double, double);
65 _ACRTIMP
double __cdecl
sqrt(double);
66 _ACRTIMP
double __cdecl
ceil(double);
67 _ACRTIMP
double __cdecl
floor(double);
68 _ACRTIMP
double __cdecl
fabs(double);
69 _ACRTIMP
double __cdecl
ldexp(double, int);
70 _ACRTIMP
double __cdecl
frexp(double, int*);
71 _ACRTIMP
double __cdecl
modf(double, double*);
72 _ACRTIMP
double __cdecl
fmod(double, double);
73 _ACRTIMP
double __cdecl
fmin(double, double);
74 _ACRTIMP
double __cdecl
fmax(double, double);
75 _ACRTIMP
double __cdecl
erf(double);
76 _ACRTIMP
double __cdecl
remquo(double, double, int*);
77 _ACRTIMP
float __cdecl
remquof(float, float, int*);
79 _ACRTIMP
double __cdecl
_hypot(double, double);
80 _ACRTIMP
double __cdecl
_j0(double);
81 _ACRTIMP
double __cdecl
_j1(double);
82 _ACRTIMP
double __cdecl
_jn(int, double);
83 _ACRTIMP
double __cdecl
_y0(double);
84 _ACRTIMP
double __cdecl
_y1(double);
85 _ACRTIMP
double __cdecl
_yn(int, double);
87 _ACRTIMP
double __cdecl
cbrt(double);
88 _ACRTIMP
double __cdecl
exp2(double);
89 _ACRTIMP
double __cdecl
log2(double);
90 _ACRTIMP
double __cdecl
rint(double);
91 _ACRTIMP
double __cdecl
round(double);
92 _ACRTIMP
double __cdecl
trunc(double);
94 _ACRTIMP
float __cdecl
cbrtf(float);
95 _ACRTIMP
float __cdecl
exp2f(float);
96 _ACRTIMP
float __cdecl
log2f(float);
97 _ACRTIMP
float __cdecl
rintf(float);
98 _ACRTIMP
float __cdecl
roundf(float);
99 _ACRTIMP
float __cdecl
truncf(float);
101 _ACRTIMP __msvcrt_long __cdecl
lrint(double);
102 _ACRTIMP __msvcrt_long __cdecl
lrintf(float);
103 _ACRTIMP __msvcrt_long __cdecl
lround(double);
104 _ACRTIMP __msvcrt_long __cdecl
lroundf(float);
106 _ACRTIMP
double __cdecl
scalbn(double,int);
107 _ACRTIMP
float __cdecl
scalbnf(float,int);
109 _ACRTIMP
double __cdecl
_copysign (double, double);
110 _ACRTIMP
double __cdecl
_chgsign (double);
111 _ACRTIMP
double __cdecl
_scalb(double, __msvcrt_long
);
112 _ACRTIMP
double __cdecl
_logb(double);
113 _ACRTIMP
double __cdecl
_nextafter(double, double);
114 _ACRTIMP
int __cdecl
_finite(double);
115 _ACRTIMP
int __cdecl
_isnan(double);
116 _ACRTIMP
int __cdecl
_fpclass(double);
120 _ACRTIMP
float __cdecl
sinf(float);
121 _ACRTIMP
float __cdecl
cosf(float);
122 _ACRTIMP
float __cdecl
tanf(float);
123 _ACRTIMP
float __cdecl
sinhf(float);
124 _ACRTIMP
float __cdecl
coshf(float);
125 _ACRTIMP
float __cdecl
tanhf(float);
126 _ACRTIMP
float __cdecl
asinf(float);
127 _ACRTIMP
float __cdecl
acosf(float);
128 _ACRTIMP
float __cdecl
atanf(float);
129 _ACRTIMP
float __cdecl
atan2f(float, float);
130 _ACRTIMP
float __cdecl
atanhf(float);
131 _ACRTIMP
float __cdecl
expf(float);
132 _ACRTIMP
float __cdecl
logf(float);
133 _ACRTIMP
float __cdecl
log10f(float);
134 _ACRTIMP
float __cdecl
powf(float, float);
135 _ACRTIMP
float __cdecl
sqrtf(float);
136 _ACRTIMP
float __cdecl
ceilf(float);
137 _ACRTIMP
float __cdecl
floorf(float);
138 _ACRTIMP
float __cdecl
frexpf(float, int*);
139 _ACRTIMP
float __cdecl
modff(float, float*);
140 _ACRTIMP
float __cdecl
fmodf(float, float);
142 _ACRTIMP
int __cdecl
_finitef(float);
143 _ACRTIMP
int __cdecl
_isnanf(float);
144 _ACRTIMP
int __cdecl
_fpclassf(float);
148 static inline float sinf(float x
) { return sin(x
); }
149 static inline float cosf(float x
) { return cos(x
); }
150 static inline float tanf(float x
) { return tan(x
); }
151 static inline float sinhf(float x
) { return sinh(x
); }
152 static inline float coshf(float x
) { return cosh(x
); }
153 static inline float tanhf(float x
) { return tanh(x
); }
154 static inline float asinf(float x
) { return asin(x
); }
155 static inline float acosf(float x
) { return acos(x
); }
156 static inline float atanf(float x
) { return atan(x
); }
157 static inline float atan2f(float x
, float y
) { return atan2(x
, y
); }
158 static inline float expf(float x
) { return exp(x
); }
159 static inline float logf(float x
) { return log(x
); }
160 static inline float log10f(float x
) { return log10(x
); }
161 static inline float powf(float x
, float y
) { return pow(x
, y
); }
162 static inline float sqrtf(float x
) { return sqrt(x
); }
163 static inline float ceilf(float x
) { return ceil(x
); }
164 static inline float floorf(float x
) { return floor(x
); }
165 static inline float frexpf(float x
, int *y
) { return frexp(x
, y
); }
166 static inline float modff(float x
, float *y
) { double yd
, ret
= modf(x
, &yd
); *y
= yd
; return ret
; }
167 static inline float fmodf(float x
, float y
) { return fmod(x
, y
); }
169 static inline int _finitef(float x
) { return _finite(x
); }
170 static inline int _isnanf(float x
) { return _isnan(x
); }
172 static inline int _fpclassf(float x
)
174 unsigned int ix
= *(int*)&x
;
177 /* construct denormal double */
178 if (!(ix
>> 23 & 0xff) && (ix
<< 1))
180 unsigned __int64 id
= (((unsigned __int64
)ix
>> 31) << 63) | 1;
188 #if !defined(__i386__) && !defined(__x86_64__) && (_MSVCR_VER == 0 || _MSVCR_VER >= 110)
189 _ACRTIMP
float __cdecl
fabsf(float);
191 static inline float fabsf(float x
) { return fabs(x
); }
194 #if !defined(__i386__) || _MSVCR_VER>=120
196 _ACRTIMP
float __cdecl
_chgsignf(float);
197 _ACRTIMP
float __cdecl
_copysignf(float, float);
198 _ACRTIMP
float __cdecl
_logbf(float);
199 _ACRTIMP
float __cdecl
acoshf(float);
200 _ACRTIMP
float __cdecl
asinhf(float);
201 _ACRTIMP
float __cdecl
atanhf(float);
205 static inline float _chgsignf(float x
) { return _chgsign(x
); }
206 static inline float _copysignf(float x
, float y
) { return _copysign(x
, y
); }
207 static inline float _logbf(float x
) { return _logb(x
); }
208 static inline float acoshf(float x
) { return acosh(x
); }
209 static inline float asinhf(float x
) { return asinh(x
); }
210 static inline float atanhf(float x
) { return atanh(x
); }
214 static inline float ldexpf(float x
, int y
) { return ldexp(x
, y
); }
217 _ACRTIMP
double __cdecl
copysign(double, double);
218 _ACRTIMP
float __cdecl
copysignf(float, float);
220 #define copysign(x,y) _copysign(x,y)
221 #define copysignf(x,y) _copysignf(x,y)
224 _ACRTIMP
double __cdecl
nearbyint(double);
225 _ACRTIMP
float __cdecl
nearbyintf(float);
226 _ACRTIMP
float __cdecl
_hypotf(float, float);
227 _ACRTIMP
int __cdecl
_matherr(struct _exception
*);
228 _ACRTIMP
double __cdecl
_cabs(struct _complex
);
230 #if (defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))) || defined(__clang__)
231 # define INFINITY __builtin_inff()
232 # define NAN __builtin_nanf("")
233 # define HUGE_VAL __builtin_huge_val()
238 } __inff
= { 0x7f800000 }, __nanf
= { 0x7fc00000 };
239 # define INFINITY (__inff.__f)
240 # define NAN (__nanf.__f)
241 # define HUGE_VAL ((double)INFINITY)
244 #define FP_INFINITE 1
247 #define FP_SUBNORMAL -2
251 #define FP_ILOGB0 (-0x7fffffff - _C2)
252 #define FP_ILOGBNAN 0x7fffffff
254 #if _MSVCR_VER >= 120
256 _ACRTIMP
short __cdecl
_dclass(double);
257 _ACRTIMP
short __cdecl
_fdclass(float);
258 _ACRTIMP
int __cdecl
_dsign(double);
259 _ACRTIMP
int __cdecl
_fdsign(float);
261 #define fpclassify(x) (sizeof(x) == sizeof(float) ? _fdclass(x) : _dclass(x))
262 #define signbit(x) (sizeof(x) == sizeof(float) ? _fdsign(x) : _dsign(x))
263 #define isinf(x) (fpclassify(x) == FP_INFINITE)
264 #define isnan(x) (fpclassify(x) == FP_NAN)
265 #define isnormal(x) (fpclassify(x) == FP_NORMAL)
266 #define isfinite(x) (fpclassify(x) <= 0)
270 static inline int __isnanf(float x
)
272 union { float x
; unsigned int i
; } u
= { x
};
273 return (u
.i
& 0x7fffffff) > 0x7f800000;
275 static inline int __isnan(double x
)
277 union { double x
; unsigned __int64 i
; } u
= { x
};
278 return (u
.i
& ~0ull >> 1) > 0x7ffull
<< 52;
280 static inline int __isinff(float x
)
282 union { float x
; unsigned int i
; } u
= { x
};
283 return (u
.i
& 0x7fffffff) == 0x7f800000;
285 static inline int __isinf(double x
)
287 union { double x
; unsigned __int64 i
; } u
= { x
};
288 return (u
.i
& ~0ull >> 1) == 0x7ffull
<< 52;
290 static inline int __isnormalf(float x
)
292 union { float x
; unsigned int i
; } u
= { x
};
293 return ((u
.i
+ 0x00800000) & 0x7fffffff) >= 0x01000000;
295 static inline int __isnormal(double x
)
297 union { double x
; unsigned __int64 i
; } u
= { x
};
298 return ((u
.i
+ (1ull << 52)) & ~0ull >> 1) >= 1ull << 53;
300 static inline int __signbitf(float x
)
302 union { float x
; unsigned int i
; } u
= { x
};
303 return (int)(u
.i
>> 31);
305 static inline int __signbit(double x
)
307 union { double x
; unsigned __int64 i
; } u
= { x
};
308 return (int)(u
.i
>> 63);
311 #define isinf(x) (sizeof(x) == sizeof(float) ? __isinff(x) : __isinf(x))
312 #define isnan(x) (sizeof(x) == sizeof(float) ? __isnanf(x) : __isnan(x))
313 #define isnormal(x) (sizeof(x) == sizeof(float) ? __isnormalf(x) : __isnormal(x))
314 #define signbit(x) (sizeof(x) == sizeof(float) ? __signbitf(x) : __signbit(x))
315 #define isfinite(x) (!isinf(x) && !isnan(x))
325 #if !defined(__STRICT_ANSI__) || defined(_POSIX_C_SOURCE) || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_USE_MATH_DEFINES)
326 #ifndef _MATH_DEFINES_DEFINED
327 #define _MATH_DEFINES_DEFINED
328 #define M_E 2.71828182845904523536
329 #define M_LOG2E 1.44269504088896340736
330 #define M_LOG10E 0.434294481903251827651
331 #define M_LN2 0.693147180559945309417
332 #define M_LN10 2.30258509299404568402
333 #define M_PI 3.14159265358979323846
334 #define M_PI_2 1.57079632679489661923
335 #define M_PI_4 0.785398163397448309616
336 #define M_1_PI 0.318309886183790671538
337 #define M_2_PI 0.636619772367581343076
338 #define M_2_SQRTPI 1.12837916709551257390
339 #define M_SQRT2 1.41421356237309504880
340 #define M_SQRT1_2 0.707106781186547524401
341 #endif /* !_MATH_DEFINES_DEFINED */
342 #endif /* _USE_MATH_DEFINES */
344 static inline double hypot( double x
, double y
) { return _hypot( x
, y
); }
345 static inline double j0( double x
) { return _j0( x
); }
346 static inline double j1( double x
) { return _j1( x
); }
347 static inline double jn( int n
, double x
) { return _jn( n
, x
); }
348 static inline double y0( double x
) { return _y0( x
); }
349 static inline double y1( double x
) { return _y1( x
); }
350 static inline double yn( int n
, double x
) { return _yn( n
, x
); }
352 static inline float hypotf( float x
, float y
) { return _hypotf( x
, y
); }
354 #endif /* __WINE_MATH_H */