[packages] zaptel-1.4.x: another attempt at fixing it :)
[packages.git] / libs / libnotimpl / src / math.c
1 /* vi: set sw=4 ts=4: */
2
3 #include <math.h>
4
5
6 /* cosf for uClibc
7  *
8  * wrapper for cos(x)
9  */
10
11 #ifdef __STDC__
12         float cosf(float x)
13 #else
14         float cosf(x)
15         float x;
16 #endif
17 {
18         return (float) cos( (double)x );
19 }
20
21
22 /* sinf for uClibc
23  *
24  * wrapper for sin(x)
25  */
26
27 #ifdef __STDC__
28         float sinf(float x)
29 #else
30         float sinf(x)
31         float x;
32 #endif
33 {
34         return (float) sin( (double)x );
35 }
36
37
38 /* ceilf for uClibc
39  *
40  * wrapper for ceil(x)
41  */
42
43 #ifdef __STDC__
44         float ceilf(float x)
45 #else
46         float ceilf(x)
47         float x;
48 #endif
49 {
50         return (float) ceil( (double)x );
51 }
52
53
54 /* rintf for uClibc
55  *
56  * wrapper for rint(x)
57  */
58
59 #ifdef __STDC__
60         float rintf(float x)
61 #else
62         float rintf(x)
63         float x;
64 #endif
65 {
66         return (float) rint( (double)x );
67 }
68
69 /* logf for uClibc
70  * 
71  * wrapper for logf(x)
72  */
73
74 #ifdef __STDC__
75         float logf(float x)
76 #else
77         float logf(x)
78         float x;
79 #endif
80 {
81         return (float) logf( (double)x );
82 }
83
84 /* expf for uClibc
85  *
86  * wrapper for expf(x)
87  */
88
89 #ifdef __STDC__
90     float expf(float x)
91 #else
92     float expf(x)
93     float x;
94 #endif
95 {
96     return (float) expf( (double)x );
97 }
98
99 /* lround for uClibc
100  *
101  * wrapper for lround(x)
102  */
103
104 #ifdef __STDC__
105     long lround(double x)
106 #else
107     long lround(x)
108     double x;
109 #endif
110 {
111     return (long) ((x - ((long)x) >= 0.5f) ? (((long)x) + 1) : ((long)x));
112 }
113
114 /* lround for uClibc
115  *
116  * wrapper for roundf(x)
117  */
118
119 #ifdef __STDC__
120     float roundf(float x)
121 #else
122     float roundf(x)
123         float x;
124 #endif
125 {
126         return (float) ((x - ((long)x) >= 0.5f) ? (((long)x) + 1) : ((long)x));
127 }       
128