/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to src/utility/cmath

  • Committer: edam
  • Date: 2012-02-25 01:31:43 UTC
  • Revision ID: tim@ed.am-20120225013143-9fet2y2d3fjlrwez
added ulibc

Show diffs side-by-side

added added

removed removed

 
1
/*      Copyright (C) 2006 Garrett A. Kajmowicz
 
2
 
 
3
        This file is part of the uClibc++ Library.
 
4
 
 
5
        This library is free software; you can redistribute it and/or
 
6
        modify it under the terms of the GNU Lesser General Public
 
7
        License as published by the Free Software Foundation; either
 
8
        version 2.1 of the License, or (at your option) any later version.
 
9
 
 
10
        This library is distributed in the hope that it will be useful,
 
11
        but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
        Lesser General Public License for more details.
 
14
 
 
15
        You should have received a copy of the GNU Lesser General Public
 
16
        License along with this library; if not, write to the Free Software
 
17
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
*/
 
19
 
 
20
#include <math.h>
 
21
 
 
22
#ifndef __STD_HEADER_CMATH
 
23
#define __STD_HEADER_CMATH 1
 
24
 
 
25
namespace std{
 
26
#if ! defined(__AVR__)
 
27
        using ::acos;
 
28
        using ::asin;
 
29
        using ::atan;
 
30
        using ::atan2;
 
31
        using ::ceil;
 
32
        using ::cos;
 
33
        using ::cosh;
 
34
        using ::exp;
 
35
        using ::fabs;
 
36
        using ::floor;
 
37
        using ::fmod;
 
38
        using ::frexp;
 
39
        using ::ldexp;
 
40
        using ::log;
 
41
        using ::log10;
 
42
        using ::modf;
 
43
        using ::pow;
 
44
        using ::sin;
 
45
        using ::sinh;
 
46
        using ::sqrt;
 
47
        using ::tan;
 
48
        using ::tanh;
 
49
 
 
50
        inline float abs  (float x){
 
51
                return fabsf(x);
 
52
        }
 
53
        inline float acos (float x){
 
54
                return acosf(x);
 
55
        }
 
56
        inline float asin (float x){
 
57
                return asinf(x);
 
58
        }
 
59
        inline float atan (float x){
 
60
                return atanf(x);
 
61
        }
 
62
        inline float atan2(float y, float x){
 
63
                return atan2f(y, x);
 
64
        }
 
65
        inline float ceil (float x){
 
66
                return ceilf(x);
 
67
        }
 
68
        inline float cos  (float x){
 
69
                return cosf(x);
 
70
        }
 
71
        inline float cosh (float x){
 
72
                return coshf(x);
 
73
        }
 
74
        inline float exp  (float x){
 
75
                return expf(x);
 
76
        }
 
77
        inline float fabs (float x){
 
78
                return fabsf(x);
 
79
        }
 
80
        inline float floor(float x){
 
81
                return floorf(x);
 
82
        }
 
83
        inline float fmod (float x, float y){
 
84
                return fmodf(x, y);
 
85
        }
 
86
        inline float frexp(float x, int* exp){
 
87
                return frexpf(x, exp);
 
88
        }
 
89
        inline float ldexp(float x, int exp){
 
90
                return ldexpf(x, exp);
 
91
        }
 
92
        inline float log  (float x){
 
93
                return logf(x);
 
94
        }
 
95
        inline float log10(float x){
 
96
                return log10f(x);
 
97
        }
 
98
        inline float modf (float x, float* inptr){
 
99
                return modff(x, inptr);
 
100
        }
 
101
        inline float pow  (float x, float y){
 
102
                return powf(x, y);
 
103
        }
 
104
        inline float pow  (float x, int y){
 
105
                return pow((double)x, (double)y);
 
106
        }
 
107
        inline float sin  (float x){
 
108
                return sinf(x);
 
109
        }
 
110
        inline float sinh (float x){
 
111
                return sinhf(x);
 
112
        }
 
113
        inline float sqrt (float x){
 
114
                return sqrtf(x);
 
115
        }
 
116
        inline float tan  (float x){
 
117
                return tanf(x);
 
118
        }
 
119
        inline float tanh (float x){
 
120
                return tanhf(x);
 
121
        }
 
122
        inline double abs(double x){
 
123
                return fabs(x);
 
124
        }
 
125
        inline double pow(double x, int y){
 
126
                return pow((double)x, (double)y);
 
127
        }
 
128
 
 
129
#ifdef __UCLIBCXX_HAS_LONG_DOUBLE__
 
130
        inline long double abs  (long double x){
 
131
                return fabsl(x);
 
132
        }
 
133
        inline long double acos (long double x){
 
134
                return acosl(x);
 
135
        }
 
136
        inline long double asin (long double x){
 
137
                return asinl(x);
 
138
        }
 
139
        inline long double atan (long double x){
 
140
                return atanl(x);
 
141
        }
 
142
        inline long double atan2(long double y, long double x){
 
143
                return atan2l(y, x);
 
144
        }
 
145
        inline long double ceil (long double x){
 
146
                return ceill(x);
 
147
        }
 
148
        inline long double cos  (long double x){
 
149
                return cosl(x);
 
150
        }
 
151
        inline long double cosh (long double x){
 
152
                return coshl(x);
 
153
        }
 
154
        inline long double exp  (long double x){
 
155
                return expl(x);
 
156
        }
 
157
        inline long double fabs (long double x){
 
158
                return fabsl(x);
 
159
        }
 
160
        inline long double floor(long double x){
 
161
                return floorl(x);
 
162
        }
 
163
        inline long double frexp(long double x, int* exp){
 
164
                return frexpl(x, exp);
 
165
        }
 
166
        inline long double fmod (long double x, long double y){
 
167
                return fmodl(x, y);
 
168
        }
 
169
        inline long double ldexp(long double x, int y){
 
170
                return ldexpl(x, y);
 
171
        }
 
172
        inline long double log  (long double x){
 
173
                return logl(x);
 
174
        }
 
175
        inline long double log10(long double x){
 
176
                return log10l(x);
 
177
        }
 
178
        inline long double modf (long double x, long double* iptr){
 
179
                return modfl(x, iptr);
 
180
        }
 
181
        inline long double pow  (long double x, long double y){
 
182
                return powl(x, y);
 
183
        }
 
184
        inline long double pow  (long double x, int y){
 
185
                return powl(x, (long double)y );
 
186
        }
 
187
        inline long double sin  (long double x){
 
188
                return sinl(x);
 
189
        }
 
190
        inline long double sinh (long double x){
 
191
                return sinhl(x);
 
192
        }
 
193
        inline long double sqrt (long double x){
 
194
                return sqrtl(x);
 
195
        }
 
196
        inline long double tan  (long double x){
 
197
                return tanl(x);
 
198
        }
 
199
        inline long double tanh (long double x){
 
200
                return tanhl(x);
 
201
        }
 
202
#endif  //       __UCLIBCXX_HAS_LONG_DOUBLE__
 
203
#endif // ! defined(__AVR__)
 
204
}
 
205
 
 
206
#endif  //__STD_HEADER_CMATH
 
207