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
fdim(double, double);
73 _ACRTIMP
double __cdecl
fmod(double, double);
74 _ACRTIMP
double __cdecl
fmin(double, double);
75 _ACRTIMP
double __cdecl
fmax(double, double);
76 _ACRTIMP
double __cdecl
erf(double);
77 _ACRTIMP
double __cdecl
remainder(double, double);
78 _ACRTIMP
double __cdecl
remquo(double, double, int*);
79 _ACRTIMP
float __cdecl
remquof(float, float, int*);
80 _ACRTIMP
double __cdecl
lgamma(double);
81 _ACRTIMP
double __cdecl
tgamma(double);
83 _ACRTIMP
double __cdecl
_hypot(double, double);
84 _ACRTIMP
double __cdecl
_j0(double);
85 _ACRTIMP
double __cdecl
_j1(double);
86 _ACRTIMP
double __cdecl
_jn(int, double);
87 _ACRTIMP
double __cdecl
_y0(double);
88 _ACRTIMP
double __cdecl
_y1(double);
89 _ACRTIMP
double __cdecl
_yn(int, double);
91 _ACRTIMP
double __cdecl
cbrt(double);
92 _ACRTIMP
double __cdecl
exp2(double);
93 _ACRTIMP
double __cdecl
expm1(double);
94 _ACRTIMP
double __cdecl
log1p(double);
95 _ACRTIMP
double __cdecl
log2(double);
96 _ACRTIMP
double __cdecl
logb(double);
97 _ACRTIMP
double __cdecl
rint(double);
98 _ACRTIMP
double __cdecl
round(double);
99 _ACRTIMP
double __cdecl
trunc(double);
101 _ACRTIMP
float __cdecl
cbrtf(float);
102 _ACRTIMP
float __cdecl
exp2f(float);
103 _ACRTIMP
float __cdecl
expm1f(float);
104 _ACRTIMP
float __cdecl
log1pf(float);
105 _ACRTIMP
float __cdecl
log2f(float);
106 _ACRTIMP
float __cdecl
logbf(float);
107 _ACRTIMP
float __cdecl
rintf(float);
108 _ACRTIMP
float __cdecl
roundf(float);
109 _ACRTIMP
float __cdecl
truncf(float);
111 _ACRTIMP
int __cdecl
ilogb(double);
112 _ACRTIMP
int __cdecl
ilogbf(float);
114 _ACRTIMP __int64 __cdecl
llrint(double);
115 _ACRTIMP __int64 __cdecl
llrintf(float);
116 _ACRTIMP __int64 __cdecl
llround(double);
117 _ACRTIMP __int64 __cdecl
llroundf(float);
118 _ACRTIMP __msvcrt_long __cdecl
lrint(double);
119 _ACRTIMP __msvcrt_long __cdecl
lrintf(float);
120 _ACRTIMP __msvcrt_long __cdecl
lround(double);
121 _ACRTIMP __msvcrt_long __cdecl
lroundf(float);
123 _ACRTIMP
double __cdecl
scalbn(double,int);
124 _ACRTIMP
float __cdecl
scalbnf(float,int);
125 _ACRTIMP
double __cdecl
scalbln(double,__msvcrt_long
);
126 _ACRTIMP
float __cdecl
scalblnf(float,__msvcrt_long
);
128 _ACRTIMP
double __cdecl
_copysign (double, double);
129 _ACRTIMP
double __cdecl
_chgsign (double);
130 _ACRTIMP
double __cdecl
_scalb(double, __msvcrt_long
);
131 _ACRTIMP
double __cdecl
_logb(double);
132 _ACRTIMP
double __cdecl
_nextafter(double, double);
133 _ACRTIMP
int __cdecl
_finite(double);
134 _ACRTIMP
int __cdecl
_isnan(double);
135 _ACRTIMP
int __cdecl
_fpclass(double);
137 _ACRTIMP
double __cdecl
nextafter(double, double);
139 #if !defined(__i386__) || defined(_NO_CRT_MATH_INLINE)
141 _ACRTIMP
float __cdecl
sinf(float);
142 _ACRTIMP
float __cdecl
cosf(float);
143 _ACRTIMP
float __cdecl
tanf(float);
144 _ACRTIMP
float __cdecl
sinhf(float);
145 _ACRTIMP
float __cdecl
coshf(float);
146 _ACRTIMP
float __cdecl
tanhf(float);
147 _ACRTIMP
float __cdecl
asinf(float);
148 _ACRTIMP
float __cdecl
acosf(float);
149 _ACRTIMP
float __cdecl
atanf(float);
150 _ACRTIMP
float __cdecl
atan2f(float, float);
151 _ACRTIMP
float __cdecl
atanhf(float);
152 _ACRTIMP
float __cdecl
expf(float);
153 _ACRTIMP
float __cdecl
logf(float);
154 _ACRTIMP
float __cdecl
log10f(float);
155 _ACRTIMP
float __cdecl
powf(float, float);
156 _ACRTIMP
float __cdecl
sqrtf(float);
157 _ACRTIMP
float __cdecl
ceilf(float);
158 _ACRTIMP
float __cdecl
floorf(float);
159 _ACRTIMP
float __cdecl
frexpf(float, int*);
160 _ACRTIMP
float __cdecl
modff(float, float*);
161 _ACRTIMP
float __cdecl
fmodf(float, float);
163 _ACRTIMP
int __cdecl
_finitef(float);
164 _ACRTIMP
int __cdecl
_isnanf(float);
165 _ACRTIMP
int __cdecl
_fpclassf(float);
169 static inline float sinf(float x
) { return sin(x
); }
170 static inline float cosf(float x
) { return cos(x
); }
171 static inline float tanf(float x
) { return tan(x
); }
172 static inline float sinhf(float x
) { return sinh(x
); }
173 static inline float coshf(float x
) { return cosh(x
); }
174 static inline float tanhf(float x
) { return tanh(x
); }
175 static inline float asinf(float x
) { return asin(x
); }
176 static inline float acosf(float x
) { return acos(x
); }
177 static inline float atanf(float x
) { return atan(x
); }
178 static inline float atan2f(float x
, float y
) { return atan2(x
, y
); }
179 static inline float expf(float x
) { return exp(x
); }
180 static inline float logf(float x
) { return log(x
); }
181 static inline float log10f(float x
) { return log10(x
); }
182 static inline float powf(float x
, float y
) { return pow(x
, y
); }
183 static inline float sqrtf(float x
) { return sqrt(x
); }
184 static inline float ceilf(float x
) { return ceil(x
); }
185 static inline float floorf(float x
) { return floor(x
); }
186 static inline float frexpf(float x
, int *y
) { return frexp(x
, y
); }
187 static inline float modff(float x
, float *y
) { double yd
, ret
= modf(x
, &yd
); *y
= yd
; return ret
; }
188 static inline float fmodf(float x
, float y
) { return fmod(x
, y
); }
190 static inline int _finitef(float x
) { return _finite(x
); }
191 static inline int _isnanf(float x
) { return _isnan(x
); }
193 static inline int _fpclassf(float x
)
195 unsigned int ix
= *(int*)&x
;
198 /* construct denormal double */
199 if (!(ix
>> 23 & 0xff) && (ix
<< 1))
201 unsigned __int64 id
= (((unsigned __int64
)ix
>> 31) << 63) | 1;
209 #if (!defined(__i386__) && !defined(__x86_64__) && (_MSVCR_VER == 0 || _MSVCR_VER >= 110)) || defined(_NO_CRT_MATH_INLINE)
210 _ACRTIMP
float __cdecl
fabsf(float);
212 static inline float fabsf(float x
) { return fabs(x
); }
215 #if !defined(__i386__) || _MSVCR_VER>=120 || defined(_NO_CRT_MATH_INLINE)
217 _ACRTIMP
float __cdecl
_chgsignf(float);
218 _ACRTIMP
float __cdecl
_copysignf(float, float);
219 _ACRTIMP
float __cdecl
_logbf(float);
220 _ACRTIMP
float __cdecl
acoshf(float);
221 _ACRTIMP
float __cdecl
asinhf(float);
222 _ACRTIMP
float __cdecl
atanhf(float);
223 _ACRTIMP
float __cdecl
erff(float);
224 _ACRTIMP
float __cdecl
fdimf(float, float);
225 _ACRTIMP
float __cdecl
fmaxf(float, float);
226 _ACRTIMP
float __cdecl
fminf(float, float);
227 _ACRTIMP
float __cdecl
lgammaf(float);
228 _ACRTIMP
float __cdecl
nextafterf(float, float);
229 _ACRTIMP
float __cdecl
remainderf(float, float);
230 _ACRTIMP
float __cdecl
tgammaf(float);
234 static inline float _chgsignf(float x
) { return _chgsign(x
); }
235 static inline float _copysignf(float x
, float y
) { return _copysign(x
, y
); }
236 static inline float _logbf(float x
) { return _logb(x
); }
240 static inline float ldexpf(float x
, int y
) { return ldexp(x
, y
); }
243 _ACRTIMP
double __cdecl
copysign(double, double);
244 _ACRTIMP
float __cdecl
copysignf(float, float);
246 #define copysign(x,y) _copysign(x,y)
247 #define copysignf(x,y) _copysignf(x,y)
250 _ACRTIMP
double __cdecl
nearbyint(double);
251 _ACRTIMP
float __cdecl
nearbyintf(float);
252 _ACRTIMP
float __cdecl
_hypotf(float, float);
253 _ACRTIMP
int __cdecl
_matherr(struct _exception
*);
254 _ACRTIMP
double __cdecl
_cabs(struct _complex
);
256 #if (defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))) || defined(__clang__)
257 # define INFINITY __builtin_inff()
258 # define NAN __builtin_nanf("")
259 # define HUGE_VAL __builtin_huge_val()
264 } __inff
= { 0x7f800000 }, __nanf
= { 0x7fc00000 };
265 # define INFINITY (__inff.__f)
266 # define NAN (__nanf.__f)
267 # define HUGE_VAL ((double)INFINITY)
270 #define FP_INFINITE 1
273 #define FP_SUBNORMAL -2
277 #define FP_ILOGB0 (-0x7fffffff - _C2)
278 #define FP_ILOGBNAN 0x7fffffff
280 #if _MSVCR_VER >= 120
282 _ACRTIMP
short __cdecl
_dclass(double);
283 _ACRTIMP
short __cdecl
_fdclass(float);
284 _ACRTIMP
int __cdecl
_dsign(double);
285 _ACRTIMP
int __cdecl
_fdsign(float);
287 #define fpclassify(x) (sizeof(x) == sizeof(float) ? _fdclass(x) : _dclass(x))
288 #define signbit(x) (sizeof(x) == sizeof(float) ? _fdsign(x) : _dsign(x))
289 #define isinf(x) (fpclassify(x) == FP_INFINITE)
290 #define isnan(x) (fpclassify(x) == FP_NAN)
291 #define isnormal(x) (fpclassify(x) == FP_NORMAL)
292 #define isfinite(x) (fpclassify(x) <= 0)
296 static inline int __isnanf(float x
)
298 union { float x
; unsigned int i
; } u
= { x
};
299 return (u
.i
& 0x7fffffff) > 0x7f800000;
301 static inline int __isnan(double x
)
303 union { double x
; unsigned __int64 i
; } u
= { x
};
304 return (u
.i
& ~0ull >> 1) > 0x7ffull
<< 52;
306 static inline int __isinff(float x
)
308 union { float x
; unsigned int i
; } u
= { x
};
309 return (u
.i
& 0x7fffffff) == 0x7f800000;
311 static inline int __isinf(double x
)
313 union { double x
; unsigned __int64 i
; } u
= { x
};
314 return (u
.i
& ~0ull >> 1) == 0x7ffull
<< 52;
316 static inline int __isnormalf(float x
)
318 union { float x
; unsigned int i
; } u
= { x
};
319 return ((u
.i
+ 0x00800000) & 0x7fffffff) >= 0x01000000;
321 static inline int __isnormal(double x
)
323 union { double x
; unsigned __int64 i
; } u
= { x
};
324 return ((u
.i
+ (1ull << 52)) & ~0ull >> 1) >= 1ull << 53;
326 static inline int __signbitf(float x
)
328 union { float x
; unsigned int i
; } u
= { x
};
329 return (int)(u
.i
>> 31);
331 static inline int __signbit(double x
)
333 union { double x
; unsigned __int64 i
; } u
= { x
};
334 return (int)(u
.i
>> 63);
337 #define isinf(x) (sizeof(x) == sizeof(float) ? __isinff(x) : __isinf(x))
338 #define isnan(x) (sizeof(x) == sizeof(float) ? __isnanf(x) : __isnan(x))
339 #define isnormal(x) (sizeof(x) == sizeof(float) ? __isnormalf(x) : __isnormal(x))
340 #define signbit(x) (sizeof(x) == sizeof(float) ? __signbitf(x) : __signbit(x))
341 #define isfinite(x) (!isinf(x) && !isnan(x))
347 _ACRTIMP
int __cdecl
_dpcomp(double, double);
348 _ACRTIMP
int __cdecl
_fdpcomp(float, float);
355 # define isgreater(x, y) __builtin_isgreater(x, y)
356 # define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
357 # define isless(x, y) __builtin_isless(x, y)
358 # define islessequal(x, y) __builtin_islessequal(x, y)
359 # define islessgreater(x, y) __builtin_islessgreater(x, y)
360 # define isunordered(x, y) __builtin_isunordered(x, y)
362 # define __FP_COMPARE(x,y) (sizeof(x) == sizeof(float) && sizeof(y) == sizeof(float) ? _fdpcomp(x,y) : _dpcomp(x,y))
363 # define isgreater(x, y) ((__FP_COMPARE(x, y) & _FP_GT) != 0)
364 # define isgreaterequal(x, y) ((__FP_COMPARE(x, y) & (_FP_GT|_FP_EQ)) != 0)
365 # define isless(x, y) ((__FP_COMPARE(x, y) & _FP_LT) != 0)
366 # define islessequal(x, y) ((__FP_COMPARE(x, y) & (_FP_LT|_FP_EQ)) != 0)
367 # define islessgreater(x, y) ((__FP_COMPARE(x, y) & (_FP_LT|_FP_GT)) != 0)
368 # define isunordered(x, y) (!__FP_COMPARE(x, y))
379 #if !defined(__STRICT_ANSI__) || defined(_POSIX_C_SOURCE) || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_USE_MATH_DEFINES)
380 #ifndef _MATH_DEFINES_DEFINED
381 #define _MATH_DEFINES_DEFINED
382 #define M_E 2.71828182845904523536
383 #define M_LOG2E 1.44269504088896340736
384 #define M_LOG10E 0.434294481903251827651
385 #define M_LN2 0.693147180559945309417
386 #define M_LN10 2.30258509299404568402
387 #define M_PI 3.14159265358979323846
388 #define M_PI_2 1.57079632679489661923
389 #define M_PI_4 0.785398163397448309616
390 #define M_1_PI 0.318309886183790671538
391 #define M_2_PI 0.636619772367581343076
392 #define M_2_SQRTPI 1.12837916709551257390
393 #define M_SQRT2 1.41421356237309504880
394 #define M_SQRT1_2 0.707106781186547524401
395 #endif /* !_MATH_DEFINES_DEFINED */
396 #endif /* _USE_MATH_DEFINES */
398 static inline double hypot( double x
, double y
) { return _hypot( x
, y
); }
399 static inline double j0( double x
) { return _j0( x
); }
400 static inline double j1( double x
) { return _j1( x
); }
401 static inline double jn( int n
, double x
) { return _jn( n
, x
); }
402 static inline double y0( double x
) { return _y0( x
); }
403 static inline double y1( double x
) { return _y1( x
); }
404 static inline double yn( int n
, double x
) { return _yn( n
, x
); }
406 static inline float hypotf( float x
, float y
) { return _hypotf( x
, y
); }
408 #endif /* __WINE_MATH_H */