summaryrefslogtreecommitdiffstats
path: root/private/crtlib/include/math.h
blob: 221ea54215fa36fc7a0ddce6d02282c51f1b4a11 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/***
*math.h - definitions and declarations for math library
*
*       Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
*
*Purpose:
*       This file contains constant definitions and external subroutine
*       declarations for the math subroutine library.
*       [ANSI/System V]
*
****/

#ifndef _INC_MATH

#ifdef __cplusplus
extern "C" {
#endif

#ifndef _LANGUAGE_ASSEMBLY


/*
 * Conditional macro definition for function calling type and variable type
 * qualifiers.
 */
#if   ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )

/*
 * Definitions for MS C8-32 (386/486) compiler
 */
#define _CRTAPI1 __cdecl
#define _CRTAPI2 __cdecl

#else

/*
 * Other compilers (e.g., MIPS)
 */
#define _CRTAPI1
#define _CRTAPI2

#endif


/* definition of _exception struct - this struct is passed to the matherr
 * routine when a floating point exception is detected
 */

#ifndef _EXCEPTION_DEFINED
struct _exception {
        int type;               /* exception type - see below */
        char *name;             /* name of function where error occured */
        double arg1;            /* first argument to function */
        double arg2;            /* second argument (if any) to function */
        double retval;          /* value to be returned by function */
        } ;

#if !__STDC__
/* Non-ANSI name for compatibility */
#define exception _exception
#endif

#define _EXCEPTION_DEFINED
#endif


/* definition of a _complex struct to be used by those who use cabs and
 * want type checking on their argument
 */

#ifndef _COMPLEX_DEFINED
struct _complex {
        double x,y;     /* real and imaginary parts */
        } ;

#if !__STDC__
/* Non-ANSI name for compatibility */
#define complex _complex
#endif

#define _COMPLEX_DEFINED
#endif

#endif  /* _LANGUAGE_ASSEMBLY */


/* Constant definitions for the exception type passed in the _exception struct
 */

#define _DOMAIN         1       /* argument domain error */
#define _SING           2       /* argument singularity */
#define _OVERFLOW       3       /* overflow range error */
#define _UNDERFLOW      4       /* underflow range error */
#define _TLOSS          5       /* total loss of precision */
#define _PLOSS          6       /* partial loss of precision */

#define EDOM            33
#define ERANGE          34


/* definitions of _HUGE and HUGE_VAL - respectively the XENIX and ANSI names
 * for a value returned in case of error by a number of the floating point
 * math routines
 */
#ifndef _LANGUAGE_ASSEMBLY
#ifdef  _DLL
#define _HUGE   (*_HUGE_dll)
extern double * _HUGE_dll;
#else
extern double _HUGE;
#endif
#endif  /* _LANGUAGE_ASSEMBLY */

#define HUGE_VAL _HUGE

/* function prototypes */

#ifndef _LANGUAGE_ASSEMBLY
int     _CRTAPI1 abs(int);
double  _CRTAPI1 acos(double);
double  _CRTAPI1 asin(double);
double  _CRTAPI1 atan(double);
double  _CRTAPI1 atan2(double, double);
double  _CRTAPI1 atof(const char *);
double  _CRTAPI1 _cabs(struct _complex);
double  _CRTAPI1 ceil(double);
double  _CRTAPI1 cos(double);
double  _CRTAPI1 cosh(double);
double  _CRTAPI1 exp(double);
double  _CRTAPI1 fabs(double);
double  _CRTAPI1 floor(double);
double  _CRTAPI1 fmod(double, double);
double  _CRTAPI1 frexp(double, int *);
double  _CRTAPI1 _hypot(double, double);
double  _CRTAPI1 _j0(double);
double  _CRTAPI1 _j1(double);
double  _CRTAPI1 _jn(int, double);
long    _CRTAPI1 labs(long);
double  _CRTAPI1 ldexp(double, int);
double  _CRTAPI1 log(double);
double  _CRTAPI1 log10(double);
int     _CRTAPI1 _matherr(struct _exception *);
double  _CRTAPI1 modf(double, double *);
double  _CRTAPI1 pow(double, double);
double  _CRTAPI1 sin(double);
double  _CRTAPI1 sinh(double);
double  _CRTAPI1 sqrt(double);
double  _CRTAPI1 tan(double);
double  _CRTAPI1 tanh(double);
double  _CRTAPI1 _y0(double);
double  _CRTAPI1 _y1(double);
double  _CRTAPI1 _yn(int, double);
#ifdef _M_MRX000

/* MIPS fast prototypes for float */
/* ANSI C, 4.5 Mathematics             */

/* 4.5.2 Trigonometric functions */

float  __cdecl acosf( float );
float  __cdecl asinf( float );
float  __cdecl atanf( float );
float  __cdecl atan2f( float , float );
float  __cdecl cosf( float );
float  __cdecl sinf( float );
float  __cdecl tanf( float );

/* 4.5.3 Hyperbolic functions */
float  __cdecl coshf( float );
float  __cdecl sinhf( float );
float  __cdecl tanhf( float );

/* 4.5.4 Exponential and logarithmic functions */
float  __cdecl expf( float );
float  __cdecl logf( float );
float  __cdecl log10f( float );
float  __cdecl modff( float , float* );

/* 4.5.5 Power functions */
float  __cdecl powf( float , float );
float  __cdecl sqrtf( float );

/* 4.5.6 Nearest integer, absolute value, and remainder functions */
float  __cdecl ceilf( float );
float  __cdecl fabsf( float );
float  __cdecl floorf( float );
float  __cdecl fmodf( float , float );

#endif /* _M_MRX000 */

#endif  /* _LANGUAGE_ASSEMBLY */

#if !__STDC__
/* Non-ANSI names for compatibility */

#define DOMAIN          _DOMAIN
#define SING            _SING
#define OVERFLOW        _OVERFLOW
#define UNDERFLOW       _UNDERFLOW
#define TLOSS           _TLOSS
#define PLOSS           _PLOSS

#define matherr         _matherr

#define HUGE    _HUGE

#define cabs            _cabs
#define hypot           _hypot
#define j0              _j0
#define j1              _j1
#define jn              _jn
#define matherr         _matherr
#define y0              _y0
#define y1              _y1
#define yn              _yn

#define cabsl           _cabsl
#define hypotl          _hypotl
#endif  /* __STDC__ */

#ifdef __cplusplus
}
#endif

#define _INC_MATH
#endif  /* _INC_MATH */