branch update for HEAD-2003021201
[reactos.git] / include / msvcrt / math.h
1 /* 
2  * math.h
3  *
4  * Mathematical functions.
5  *
6  * This file is part of the Mingw32 package.
7  *
8  * Contributors:
9  *  Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
10  *
11  *  THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  *  This source code is offered for use in the public domain. You may
14  *  use, modify or distribute it freely.
15  *
16  *  This code is distributed in the hope that it will be useful but
17  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  *  DISCLAIMED. This includes but is not limited to warranties of
19  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  * $Revision$
22  * $Author$
23  * $Date$
24  *
25  */
26 // added modfl 
27
28 #ifndef _MATH_H_
29 #define _MATH_H_
30
31 #include <msvcrt/crttypes.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 /*
38  * HUGE_VAL is returned by strtod when the value would overflow the
39  * representation of 'double'. There are other uses as well.
40  *
41  * __imp__HUGE is a pointer to the actual variable _HUGE in
42  * MSVCRT.DLL. If we used _HUGE directly we would get a pointer
43  * to a thunk function.
44  *
45  * NOTE: The CRTDLL version uses _HUGE_dll instead.
46  */
47 #ifdef _MSVCRT_LIB_
48 extern double*  __imp__HUGE;
49 #define HUGE_VAL    (*__imp__HUGE)
50 #else
51 /* CRTDLL */
52 extern double*  _HUGE_dll;
53 #define HUGE_VAL    (*_HUGE_dll)
54 #endif
55
56
57 struct _exception
58 {
59     int type;
60     char    *name;
61     double  arg1;
62     double  arg2;
63     double  retval;
64 };
65
66 /*
67  * Types for the above _exception structure.
68  */
69
70 #define _DOMAIN     1   /* domain error in argument */
71 #define _SING       2   /* singularity */
72 #define _OVERFLOW   3   /* range overflow */
73 #define _UNDERFLOW  4   /* range underflow */
74 #define _TLOSS      5   /* total loss of precision */
75 #define _PLOSS      6   /* partial loss of precision */
76
77 /*
78  * Exception types with non-ANSI names for compatibility.
79  */
80
81 #ifndef __STRICT_ANSI__
82 #ifndef _NO_OLDNAMES
83
84 #define DOMAIN      _DOMAIN
85 #define SING        _SING
86 #define OVERFLOW    _OVERFLOW
87 #define UNDERFLOW   _UNDERFLOW
88 #define TLOSS       _TLOSS
89 #define PLOSS       _PLOSS
90
91 #endif  /* Not _NO_OLDNAMES */
92 #endif  /* Not __STRICT_ANSI__ */
93
94
95 double  sin (double x);
96 double  cos (double x);
97 double  tan (double x);
98 double  sinh (double x);
99 double  cosh (double x);
100 double  tanh (double x);
101 double  asin (double x);
102 double  acos (double x);
103 double  atan (double x);
104 double  atan2 (double y, double x);
105 double  exp (double x);
106 double  log (double x);
107 double  log10 (double x);
108 double  pow (double x, double y);
109 long double powl (long double x,long double y);
110 double  sqrt (double x);
111 double  ceil (double x);
112 double  floor (double x);
113 double  fabs (double x);
114 double  ldexp (double x, int n);
115 double  frexp (double x, int* exp);
116 double  modf (double x, double* ip);
117 long double modfl (long double x,long double* ip);
118 double  fmod (double x, double y);
119
120
121 #ifndef __STRICT_ANSI__
122
123 /* Complex number (for cabs) */
124 struct _complex
125 {
126     double  x;  /* Real part */
127     double  y;  /* Imaginary part */
128 };
129
130 double  _cabs (struct _complex x);
131 double  _hypot (double x, double y);
132 double  _j0 (double x);
133 double  _j1 (double x);
134 double  _jn (int n, double x);
135 double  _y0 (double x);
136 double  _y1 (double x);
137 double  _yn (int n, double x);
138
139 #ifndef _NO_OLDNAMES
140
141 /*
142  * Non-underscored versions of non-ANSI functions. These reside in
143  * liboldnames.a. Provided for extra portability.
144  */
145 double cabs (struct _complex x);
146 double hypot (double x, double y);
147 double j0 (double x);
148 double j1 (double x);
149 double jn (int n, double x);
150 double y0 (double x);
151 double y1 (double x);
152 double yn (int n, double x);
153
154 #endif  /* Not _NO_OLDNAMES */
155
156 #endif  /* Not __STRICT_ANSI__ */
157
158 #ifdef __cplusplus
159 }
160 #endif
161
162
163 #ifdef __MSVCRT__
164 double  linkme_sin(double x);
165 double  linkme_cos(double x);
166 double  linkme_tan(double x);
167 double  linkme_sinh(double x);
168 double  linkme_cosh(double x);
169 double  linkme_tanh(double x);
170 double  linkme_asin(double x);
171 double  linkme_acos(double x);
172 double  linkme_atan(double x);
173 double  linkme_atan2(double y, double x);
174 double  linkme_exp(double x);
175 double  linkme_log(double x);
176 double  linkme_log10(double x);
177 double  linkme_pow(double x, double y);
178 long double  linkme_powl(long double x,long double y);
179 double  linkme_sqrt(double x);
180 double  linkme_ceil(double x);
181 double  linkme_floor(double x);
182 double  linkme_fabs(double x);
183 double  linkme_ldexp(double x, int n);
184 double  linkme_frexp(double x, int* exp);
185 double  linkme_modf(double x, double* ip);
186 long double linkme_modfl(long double x,long double* ip);
187 double  linkme_fmod(double x, double y);
188
189 //linkme_log2
190 //linkme_floor
191 //linkme_ldexp
192 //linkme_pow
193
194 #endif
195
196
197 #endif /* Not _MATH_H_ */
198