dsound: remove state machine from render buffer
[wine/multimedia.git] / include / msvcrt / math.h
blobc76fe0dffc9957874b90df808bfce7b5192a1584
1 /*
2 * Math functions.
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.
7 */
9 #ifndef __WINE_MATH_H
10 #define __WINE_MATH_H
12 #include <crtdefs.h>
14 #include <pshpack8.h>
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
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
29 struct _exception
31 int type;
32 char *name;
33 double arg1;
34 double arg2;
35 double retval;
37 #endif /* _EXCEPTION_DEFINED */
39 #ifndef _COMPLEX_DEFINED
40 #define _COMPLEX_DEFINED
41 struct _complex
43 double x; /* Real part */
44 double y; /* Imaginary part */
46 #endif /* _COMPLEX_DEFINED */
48 double __cdecl sin(double);
49 double __cdecl cos(double);
50 double __cdecl tan(double);
51 double __cdecl sinh(double);
52 double __cdecl cosh(double);
53 double __cdecl tanh(double);
54 double __cdecl asin(double);
55 double __cdecl acos(double);
56 double __cdecl atan(double);
57 double __cdecl atan2(double, double);
58 double __cdecl exp(double);
59 double __cdecl log(double);
60 double __cdecl log10(double);
61 double __cdecl pow(double, double);
62 double __cdecl sqrt(double);
63 double __cdecl ceil(double);
64 double __cdecl floor(double);
65 double __cdecl fabs(double);
66 double __cdecl ldexp(double, int);
67 double __cdecl frexp(double, int*);
68 double __cdecl modf(double, double*);
69 double __cdecl fmod(double, double);
71 double __cdecl _hypot(double, double);
72 double __cdecl _j0(double);
73 double __cdecl _j1(double);
74 double __cdecl _jn(int, double);
75 double __cdecl _y0(double);
76 double __cdecl _y1(double);
77 double __cdecl _yn(int, double);
79 double __cdecl cbrt(double);
80 double __cdecl exp2(double);
81 double __cdecl log2(double);
82 double __cdecl rint(double);
83 double __cdecl round(double);
84 double __cdecl trunc(double);
86 float __cdecl cbrtf(float);
87 float __cdecl exp2f(float);
88 float __cdecl log2f(float);
89 float __cdecl rintf(float);
90 float __cdecl roundf(float);
91 float __cdecl truncf(float);
93 long __cdecl lrint(double);
94 long __cdecl lrintf(float);
95 long __cdecl lround(double);
96 long __cdecl lroundf(float);
98 #if defined(__x86_64__) || defined(__arm__)
100 float __cdecl sinf(float);
101 float __cdecl cosf(float);
102 float __cdecl tanf(float);
103 float __cdecl sinhf(float);
104 float __cdecl coshf(float);
105 float __cdecl tanhf(float);
106 float __cdecl asinf(float);
107 float __cdecl acosf(float);
108 float __cdecl atanf(float);
109 float __cdecl atan2f(float, float);
110 float __cdecl expf(float);
111 float __cdecl logf(float);
112 float __cdecl log10f(float);
113 float __cdecl powf(float, float);
114 float __cdecl sqrtf(float);
115 float __cdecl ceilf(float);
116 float __cdecl floorf(float);
117 float __cdecl fabsf(float);
118 float __cdecl ldexpf(float, int);
119 float __cdecl frexpf(float, int*);
120 float __cdecl modff(float, float*);
121 float __cdecl fmodf(float, float);
123 #else
125 #define sinf(x) ((float)sin((double)(x)))
126 #define cosf(x) ((float)cos((double)(x)))
127 #define tanf(x) ((float)tan((double)(x)))
128 #define sinhf(x) ((float)sinh((double)(x)))
129 #define coshf(x) ((float)cosh((double)(x)))
130 #define tanhf(x) ((float)tanh((double)(x)))
131 #define asinf(x) ((float)asin((double)(x)))
132 #define acosf(x) ((float)acos((double)(x)))
133 #define atanf(x) ((float)atan((double)(x)))
134 #define atan2f(x,y) ((float)atan2((double)(x), (double)(y)))
135 #define expf(x) ((float)exp((double)(x)))
136 #define logf(x) ((float)log((double)(x)))
137 #define log10f(x) ((float)log10((double)(x)))
138 #define powf(x,y) ((float)pow((double)(x), (double)(y)))
139 #define sqrtf(x) ((float)sqrt((double)(x)))
140 #define ceilf(x) ((float)ceil((double)(x)))
141 #define floorf(x) ((float)floor((double)(x)))
142 #define fabsf(x) ((float)fabs((double)(x)))
143 #define frexpf(x) ((float)frexp((double)(x)))
144 #define modff(x,y) ((float)modf((double)(x), (double*)(y)))
145 #define fmodf(x,y) ((float)fmod((double)(x), (double)(y)))
147 #endif
149 #define ldexpf(x,y) ((float)ldexp((double)(x),(y)))
151 float __cdecl _hypotf(float, float);
153 int __cdecl _matherr(struct _exception*);
154 double __cdecl _cabs(struct _complex);
156 #ifndef HUGE_VAL
157 # if defined(__GNUC__) && (__GNUC__ >= 3)
158 # define HUGE_VAL (__extension__ 0x1.0p2047)
159 # else
160 static const union {
161 unsigned char __c[8];
162 double __d;
163 } __huge_val = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };
164 # define HUGE_VAL (__huge_val.__d)
165 # endif
166 #endif
168 #define FP_INFINITE 1
169 #define FP_NAN 2
170 #define FP_NORMAL -1
171 #define FP_SUBNORMAL -2
172 #define FP_ZERO 0
174 #ifdef __cplusplus
176 #endif
178 #include <poppack.h>
180 #ifdef _USE_MATH_DEFINES
181 #ifndef _MATH_DEFINES_DEFINED
182 #define _MATH_DEFINES_DEFINED
183 #define M_E 2.71828182845904523536
184 #define M_LOG2E 1.44269504088896340736
185 #define M_LOG10E 0.434294481903251827651
186 #define M_LN2 0.693147180559945309417
187 #define M_LN10 2.30258509299404568402
188 #define M_PI 3.14159265358979323846
189 #define M_PI_2 1.57079632679489661923
190 #define M_PI_4 0.785398163397448309616
191 #define M_1_PI 0.318309886183790671538
192 #define M_2_PI 0.636619772367581343076
193 #define M_2_SQRTPI 1.12837916709551257390
194 #define M_SQRT2 1.41421356237309504880
195 #define M_SQRT1_2 0.707106781186547524401
196 #endif /* !_MATH_DEFINES_DEFINED */
197 #endif /* _USE_MATH_DEFINES */
199 static inline double hypot( double x, double y ) { return _hypot( x, y ); }
200 static inline double j0( double x ) { return _j0( x ); }
201 static inline double j1( double x ) { return _j1( x ); }
202 static inline double jn( int n, double x ) { return _jn( n, x ); }
203 static inline double y0( double x ) { return _y0( x ); }
204 static inline double y1( double x ) { return _y1( x ); }
205 static inline double yn( int n, double x ) { return _yn( n, x ); }
206 static inline double cabs(struct _complex z) { return _cabs( z ); }
208 static inline float hypotf( float x, float y ) { return _hypotf( x, y ); }
210 #endif /* __WINE_MATH_H */