-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath.h
142 lines (129 loc) · 3.61 KB
/
math.h
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
#ifndef _MATH_H
#define _MATH_H
#define HUGE_VAL (__DBL_MAX__ * 2.0)
/*
* prototypes for the standard C maths functions.
*/
#if (__DBL_MANT_DIG__ != __FLT_MANT_DIG__)
double acos(double);
double asin(double);
double atan(double);
double atan2(double, double);
double cos(double);
double sin(double);
double tan(double);
double cosh(double);
double sinh(double);
double tanh(double);
double exp(double);
double frexp(double, int *);
double ldexp(double, int);
double log(double);
double log10(double);
double modf(double, double *);
double pow(double, double);
double sqrt(double);
double ceil(double);
double fabs(double);
double floor(double);
double fmod(double, double);
#endif
/*
* prototypes for the float maths functions.
*/
float acosf(float);
float asinf(float);
float atanf(float);
float atan2f(float, float);
float cosf(float);
float sinf(float);
float tanf(float);
float coshf(float);
float sinhf(float);
float tanhf(float);
float expf(float);
float frexpf(float, int *);
float ldexpf(float, int);
float logf(float);
float log10f(float);
#if (__DBL_MANT_DIG__ == __FLT_MANT_DIG__)
/*
* Without -fno-short-double, float * and double * are compatable, but a
* warning can still be produced.
*/
float modff(float, void *);
#else
float modff(float, float *);
#endif
float powf(float, float);
float sqrtf(float);
float ceilf(float);
float fabsf(float);
float floorf(float);
float fmodf(float, float);
/*
* prototypes for long double maths functions. On dsPIC30, long double
* is always 64bits regardless of the setting of the -fno-short-double
* and -fshort-double options.
*/
long double acosl(long double);
long double asinl(long double);
long double atanl(long double);
long double atan2l(long double, long double);
long double cosl(long double);
long double sinl(long double);
long double tanl(long double);
long double coshl(long double);
long double sinhl(long double);
long double tanhl(long double);
long double expl(long double);
long double frexpl(long double, int *);
long double ldexpl(long double, int);
long double logl(long double);
long double log10l(long double);
long double modfl(long double, long double *);
long double powl(long double, long double);
long double sqrtl(long double);
long double ceill(long double);
long double fabsl(long double);
long double floorl(long double);
long double fmodl(long double, long double);
/*
* macro definitions to ensure that the default functions are correct
* for the chosen size of double: see -fno-short-double and -fshort-double
*/
#if (__DBL_MANT_DIG__ == __FLT_MANT_DIG__)
#define __MPROTO(x) x ## f
#else
#define __MPROTO(x) x
#endif
#define acos __MPROTO(acos)
#define asin __MPROTO(asin)
#define atan __MPROTO(atan)
#define atan2 __MPROTO(atan2)
#define cos __MPROTO(cos)
#define sin __MPROTO(sin)
#define tan __MPROTO(tan)
#define cosh __MPROTO(cosh)
#define sinh __MPROTO(sinh)
#define tanh __MPROTO(tanh)
#define exp __MPROTO(exp)
#define frexp __MPROTO(frexp)
#define ldexp __MPROTO(ldexp)
#define log __MPROTO(log)
#define log10 __MPROTO(log10)
#define modf __MPROTO(modf)
#define pow __MPROTO(pow)
#define sqrt __MPROTO(sqrt)
#define ceil __MPROTO(ceil)
#define fabs __MPROTO(fabs)
#define floor __MPROTO(floor)
#define fmod __MPROTO(fmod)
/*
* Prototypes for non-standard maths functions; these are part of libm
* and will be satisfied by libm-<omf>.a which is automatically included
* by the compiler.
*/
unsigned long __udiv3216(unsigned long, unsigned int);
long __div3216(long, int);
#endif