source: mainline/uspace/lib/math/arch/arm32/include/libarch/math.h@ ba8eecf

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since ba8eecf was 9adb61d, checked in by Jiri Svoboda <jiri@…>, 10 years ago

Add single-precision variant for all functions. Allow generic implementations to call other functions while selecting the number of bits of precision, but not the implementation (generic or arch-specific).

  • Property mode set to 100644
File size: 4.6 KB
Line 
1/*
2 * Copyright (c) 2014 Martin Decky
3 * Copyright (c) 2015 Jiri Svoboda
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup libmatharm32
31 * @{
32 */
33/** @file
34 */
35
36#ifndef LIBMATH_arm32_MATH_H_
37#define LIBMATH_arm32_MATH_H_
38
39#include <ceil.h>
40#include <exp.h>
41#include <floor.h>
42#include <log.h>
43#include <mathtypes.h>
44#include <mod.h>
45#include <pow.h>
46#include <trunc.h>
47#include <trig.h>
48
49static inline float64_t ceil_f64(float64_t val)
50{
51 return float64_ceil(val);
52}
53
54static inline float32_t ceil_f32(float32_t val)
55{
56 return float32_ceil(val);
57}
58
59static inline float64_t cos_f64(float64_t val)
60{
61 return float64_cos(val);
62}
63
64static inline float32_t cos_f32(float32_t val)
65{
66 return float32_cos(val);
67}
68
69static inline float64_t exp_f64(float64_t val)
70{
71 return float64_exp(val);
72}
73
74static inline float32_t exp_f32(float32_t val)
75{
76 return float32_exp(val);
77}
78
79static inline float64_t floor_f64(float64_t val)
80{
81 return float64_floor(val);
82}
83
84static inline float32_t floor_f32(float32_t val)
85{
86 return float32_floor(val);
87}
88
89static inline float64_t fmod_f64(float64_t dividend, float64_t divisor)
90{
91 return float64_mod(dividend, divisor);
92}
93
94static inline float64_t fmod_f32(float32_t dividend, float32_t divisor)
95{
96 return float32_mod(dividend, divisor);
97}
98
99static inline float64_t log_f64(float64_t val)
100{
101 return float64_log(val);
102}
103
104static inline float32_t log_f32(float32_t val)
105{
106 return float32_log(val);
107}
108
109static inline float64_t pow_f64(float64_t x, float64_t y)
110{
111 return float64_pow(x, y);
112}
113
114static inline float32_t pow_f32(float32_t x, float32_t y)
115{
116 return float32_pow(x, y);
117}
118
119static inline float64_t sin_f64(float64_t val)
120{
121 return float64_sin(val);
122}
123
124static inline float32_t sin_f32(float32_t val)
125{
126 return float32_sin(val);
127}
128
129static inline float64_t trunc_f64(float64_t val)
130{
131 return float64_trunc(val);
132}
133
134static inline float32_t trunc_f32(float32_t val)
135{
136 return float32_trunc(val);
137}
138
139static inline float64_t ceil(float64_t val)
140{
141 return ceil_f64(val);
142}
143
144static inline float32_t ceilf(float32_t val)
145{
146 return ceil_f32(val);
147}
148
149static inline float64_t cos(float64_t val)
150{
151 return cos_f64(val);
152}
153
154static inline float32_t cosf(float32_t val)
155{
156 return cos_f32(val);
157}
158
159static inline float64_t exp(float64_t val)
160{
161 return exp_f64(val);
162}
163
164static inline float32_t expf(float32_t val)
165{
166 return exp_f32(val);
167}
168
169static inline float64_t floor(float64_t val)
170{
171 return floor_f64(val);
172}
173
174static inline float32_t floorf(float32_t val)
175{
176 return floor_f32(val);
177}
178
179static inline float64_t fmod(float64_t dividend, float64_t divisor)
180{
181 return fmod_f64(dividend, divisor);
182}
183
184static inline float32_t fmodf(float32_t dividend, float32_t divisor)
185{
186 return fmod_f32(dividend, divisor);
187}
188
189static inline float64_t log(float64_t val)
190{
191 return log_f64(val);
192}
193
194static inline float32_t logf(float32_t val)
195{
196 return log_f32(val);
197}
198
199static inline float64_t pow(float64_t x, float64_t y)
200{
201 return pow_f64(x, y);
202}
203
204static inline float32_t powf(float32_t x, float32_t y)
205{
206 return pow_f32(x, y);
207}
208
209static inline float64_t sin(float64_t val)
210{
211 return sin_f64(val);
212}
213
214static inline float32_t sinf(float32_t val)
215{
216 return sin_f32(val);
217}
218
219static inline float64_t trunc(float64_t val)
220{
221 return trunc_f64(val);
222}
223
224static inline float32_t truncf(float32_t val)
225{
226 return trunc_f32(val);
227}
228
229#endif
230
231/** @}
232 */
Note: See TracBrowser for help on using the repository browser.