ucrtbase: Make the strtod implementation C99 compatible.
[wine/multimedia.git] / include / msvcrt / math.h
blobc1333d4afefbc98574ca065ad011693dbe978133
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 #ifdef __x86_64__
81 float __cdecl sinf(float);
82 float __cdecl cosf(float);
83 float __cdecl tanf(float);
84 float __cdecl sinhf(float);
85 float __cdecl coshf(float);
86 float __cdecl tanhf(float);
87 float __cdecl asinf(float);
88 float __cdecl acosf(float);
89 float __cdecl atanf(float);
90 float __cdecl atan2f(float, float);
91 float __cdecl expf(float);
92 float __cdecl logf(float);
93 float __cdecl log10f(float);
94 float __cdecl powf(float, float);
95 float __cdecl sqrtf(float);
96 float __cdecl ceilf(float);
97 float __cdecl floorf(float);
98 float __cdecl fabsf(float);
99 float __cdecl ldexpf(float, int);
100 float __cdecl frexpf(float, int*);
101 float __cdecl modff(float, float*);
102 float __cdecl fmodf(float, float);
104 #else
106 #define sinf(x) ((float)sin((double)(x)))
107 #define cosf(x) ((float)cos((double)(x)))
108 #define tanf(x) ((float)tan((double)(x)))
109 #define sinhf(x) ((float)sinh((double)(x)))
110 #define coshf(x) ((float)cosh((double)(x)))
111 #define tanhf(x) ((float)tanh((double)(x)))
112 #define asinf(x) ((float)asin((double)(x)))
113 #define acosf(x) ((float)acos((double)(x)))
114 #define atanf(x) ((float)atan((double)(x)))
115 #define atan2f(x,y) ((float)atan2((double)(x), (double)(y)))
116 #define expf(x) ((float)exp((double)(x)))
117 #define logf(x) ((float)log((double)(x)))
118 #define log10f(x) ((float)log10((double)(x)))
119 #define powf(x,y) ((float)pow((double)(x), (double)(y)))
120 #define sqrtf(x) ((float)sqrt((double)(x)))
121 #define ceilf(x) ((float)ceil((double)(x)))
122 #define floorf(x) ((float)floor((double)(x)))
123 #define frexpf(x) ((float)frexp((double)(x)))
124 #define modff(x,y) ((float)modf((double)(x), (double*)(y)))
125 #define fmodf(x,y) ((float)fmod((double)(x), (double)(y)))
127 #endif
129 #define fabsf(x) ((float)fabs((double)(x)))
130 #define ldexpf(x,y) ((float)ldexp((double)(x),(y)))
132 float __cdecl _hypotf(float, float);
134 int __cdecl _matherr(struct _exception*);
135 double __cdecl _cabs(struct _complex);
137 #ifndef HUGE_VAL
138 # if defined(__GNUC__) && (__GNUC__ >= 3)
139 # define HUGE_VAL (__extension__ 0x1.0p2047)
140 # else
141 static const union {
142 unsigned char __c[8];
143 double __d;
144 } __huge_val = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };
145 # define HUGE_VAL (__huge_val.__d)
146 # endif
147 #endif
149 #define FP_INFINITE 1
150 #define FP_NAN 2
151 #define FP_NORMAL -1
152 #define FP_SUBNORMAL -2
153 #define FP_ZERO 0
155 #ifdef __cplusplus
157 #endif
159 #include <poppack.h>
161 #ifdef _USE_MATH_DEFINES
162 #ifndef _MATH_DEFINES_DEFINED
163 #define _MATH_DEFINES_DEFINED
164 #define M_E 2.71828182845904523536
165 #define M_LOG2E 1.44269504088896340736
166 #define M_LOG10E 0.434294481903251827651
167 #define M_LN2 0.693147180559945309417
168 #define M_LN10 2.30258509299404568402
169 #define M_PI 3.14159265358979323846
170 #define M_PI_2 1.57079632679489661923
171 #define M_PI_4 0.785398163397448309616
172 #define M_1_PI 0.318309886183790671538
173 #define M_2_PI 0.636619772367581343076
174 #define M_2_SQRTPI 1.12837916709551257390
175 #define M_SQRT2 1.41421356237309504880
176 #define M_SQRT1_2 0.707106781186547524401
177 #endif /* !_MATH_DEFINES_DEFINED */
178 #endif /* _USE_MATH_DEFINES */
180 static inline double hypot( double x, double y ) { return _hypot( x, y ); }
181 static inline double j0( double x ) { return _j0( x ); }
182 static inline double j1( double x ) { return _j1( x ); }
183 static inline double jn( int n, double x ) { return _jn( n, x ); }
184 static inline double y0( double x ) { return _y0( x ); }
185 static inline double y1( double x ) { return _y1( x ); }
186 static inline double yn( int n, double x ) { return _yn( n, x ); }
187 static inline double cabs(struct _complex z) { return _cabs( z ); }
189 static inline float hypotf( float x, float y ) { return _hypotf( x, y ); }
191 #endif /* __WINE_MATH_H */