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 <acos.h>
|
---|
40 | #include <asin.h>
|
---|
41 | #include <atan.h>
|
---|
42 | #include <atan2.h>
|
---|
43 | #include <ceil.h>
|
---|
44 | #include <cosh.h>
|
---|
45 | #include <exp.h>
|
---|
46 | #include <fabs.h>
|
---|
47 | #include <floor.h>
|
---|
48 | #include <fmod.h>
|
---|
49 | #include <frexp.h>
|
---|
50 | #include <ldexp.h>
|
---|
51 | #include <log.h>
|
---|
52 | #include <log10.h>
|
---|
53 | #include <mathtypes.h>
|
---|
54 | #include <modf.h>
|
---|
55 | #include <pow.h>
|
---|
56 | #include <sinh.h>
|
---|
57 | #include <sqrt.h>
|
---|
58 | #include <tan.h>
|
---|
59 | #include <tanh.h>
|
---|
60 | #include <trig.h>
|
---|
61 | #include <trunc.h>
|
---|
62 |
|
---|
63 | #define HUGE_VAL FLOAT64_INF
|
---|
64 |
|
---|
65 | static inline float64_t acos_f64(float64_t val)
|
---|
66 | {
|
---|
67 | return float64_acos(val);
|
---|
68 | }
|
---|
69 |
|
---|
70 | static inline float32_t acos_f32(float32_t val)
|
---|
71 | {
|
---|
72 | return float32_acos(val);
|
---|
73 | }
|
---|
74 |
|
---|
75 | static inline float64_t asin_f64(float64_t val)
|
---|
76 | {
|
---|
77 | return float64_asin(val);
|
---|
78 | }
|
---|
79 |
|
---|
80 | static inline float32_t asin_f32(float32_t val)
|
---|
81 | {
|
---|
82 | return float32_asin(val);
|
---|
83 | }
|
---|
84 |
|
---|
85 | static inline float64_t atan_f64(float64_t val)
|
---|
86 | {
|
---|
87 | return float64_atan(val);
|
---|
88 | }
|
---|
89 |
|
---|
90 | static inline float32_t atan_f32(float32_t val)
|
---|
91 | {
|
---|
92 | return float32_atan(val);
|
---|
93 | }
|
---|
94 |
|
---|
95 | static inline float64_t atan2_f64(float64_t y, float64_t x)
|
---|
96 | {
|
---|
97 | return float64_atan2(y, x);
|
---|
98 | }
|
---|
99 |
|
---|
100 | static inline float32_t atan2_f32(float32_t y, float32_t x)
|
---|
101 | {
|
---|
102 | return float32_atan2(y, x);
|
---|
103 | }
|
---|
104 |
|
---|
105 | static inline float64_t ceil_f64(float64_t val)
|
---|
106 | {
|
---|
107 | return float64_ceil(val);
|
---|
108 | }
|
---|
109 |
|
---|
110 | static inline float32_t ceil_f32(float32_t val)
|
---|
111 | {
|
---|
112 | return float32_ceil(val);
|
---|
113 | }
|
---|
114 |
|
---|
115 | static inline float64_t cos_f64(float64_t val)
|
---|
116 | {
|
---|
117 | return float64_cos(val);
|
---|
118 | }
|
---|
119 |
|
---|
120 | static inline float32_t cos_f32(float32_t val)
|
---|
121 | {
|
---|
122 | return float32_cos(val);
|
---|
123 | }
|
---|
124 |
|
---|
125 | static inline float64_t cosh_f64(float64_t val)
|
---|
126 | {
|
---|
127 | return float64_cosh(val);
|
---|
128 | }
|
---|
129 |
|
---|
130 | static inline float32_t cosh_f32(float32_t val)
|
---|
131 | {
|
---|
132 | return float32_cosh(val);
|
---|
133 | }
|
---|
134 |
|
---|
135 | static inline float64_t exp_f64(float64_t val)
|
---|
136 | {
|
---|
137 | return float64_exp(val);
|
---|
138 | }
|
---|
139 |
|
---|
140 | static inline float32_t exp_f32(float32_t val)
|
---|
141 | {
|
---|
142 | return float32_exp(val);
|
---|
143 | }
|
---|
144 |
|
---|
145 | static inline float64_t fabs_f64(float64_t val)
|
---|
146 | {
|
---|
147 | return float64_fabs(val);
|
---|
148 | }
|
---|
149 |
|
---|
150 | static inline float32_t fabs_f32(float32_t val)
|
---|
151 | {
|
---|
152 | return float32_fabs(val);
|
---|
153 | }
|
---|
154 |
|
---|
155 | static inline float64_t floor_f64(float64_t val)
|
---|
156 | {
|
---|
157 | return float64_floor(val);
|
---|
158 | }
|
---|
159 |
|
---|
160 | static inline float32_t floor_f32(float32_t val)
|
---|
161 | {
|
---|
162 | return float32_floor(val);
|
---|
163 | }
|
---|
164 | static inline float64_t fmod_f64(float64_t dividend, float64_t divisor)
|
---|
165 | {
|
---|
166 | return float64_fmod(dividend, divisor);
|
---|
167 | }
|
---|
168 |
|
---|
169 | static inline float64_t fmod_f32(float32_t dividend, float32_t divisor)
|
---|
170 | {
|
---|
171 | return float32_fmod(dividend, divisor);
|
---|
172 | }
|
---|
173 |
|
---|
174 | static inline float64_t frexp_f64(float64_t x, int *exp)
|
---|
175 | {
|
---|
176 | return float64_frexp(x, exp);
|
---|
177 | }
|
---|
178 |
|
---|
179 | static inline float64_t frexp_f32(float32_t x, int *exp)
|
---|
180 | {
|
---|
181 | return float32_frexp(x, exp);
|
---|
182 | }
|
---|
183 |
|
---|
184 | static inline float64_t ldexp_f64(float64_t x, int exp)
|
---|
185 | {
|
---|
186 | return float64_ldexp(x, exp);
|
---|
187 | }
|
---|
188 |
|
---|
189 | static inline float64_t ldexp_f32(float32_t x, int exp)
|
---|
190 | {
|
---|
191 | return float32_ldexp(x, exp);
|
---|
192 | }
|
---|
193 |
|
---|
194 | static inline float64_t log_f64(float64_t val)
|
---|
195 | {
|
---|
196 | return float64_log(val);
|
---|
197 | }
|
---|
198 |
|
---|
199 | static inline float32_t log_f32(float32_t val)
|
---|
200 | {
|
---|
201 | return float32_log(val);
|
---|
202 | }
|
---|
203 |
|
---|
204 | static inline float64_t log10_f64(float64_t val)
|
---|
205 | {
|
---|
206 | return float64_log10(val);
|
---|
207 | }
|
---|
208 |
|
---|
209 | static inline float32_t log10_f32(float32_t val)
|
---|
210 | {
|
---|
211 | return float32_log10(val);
|
---|
212 | }
|
---|
213 |
|
---|
214 | static inline float64_t modf_f64(float64_t value, float64_t *iptr)
|
---|
215 | {
|
---|
216 | return float64_modf(value, iptr);
|
---|
217 | }
|
---|
218 |
|
---|
219 | static inline float64_t modf_f32(float32_t value, float32_t *iptr)
|
---|
220 | {
|
---|
221 | return float32_modf(value, iptr);
|
---|
222 | }
|
---|
223 |
|
---|
224 | static inline float64_t pow_f64(float64_t x, float64_t y)
|
---|
225 | {
|
---|
226 | return float64_pow(x, y);
|
---|
227 | }
|
---|
228 |
|
---|
229 | static inline float32_t pow_f32(float32_t x, float32_t y)
|
---|
230 | {
|
---|
231 | return float32_pow(x, y);
|
---|
232 | }
|
---|
233 |
|
---|
234 | static inline float64_t sin_f64(float64_t val)
|
---|
235 | {
|
---|
236 | return float64_sin(val);
|
---|
237 | }
|
---|
238 |
|
---|
239 | static inline float32_t sin_f32(float32_t val)
|
---|
240 | {
|
---|
241 | return float32_sin(val);
|
---|
242 | }
|
---|
243 |
|
---|
244 | static inline float64_t sinh_f64(float64_t val)
|
---|
245 | {
|
---|
246 | return float64_sinh(val);
|
---|
247 | }
|
---|
248 |
|
---|
249 | static inline float32_t sinh_f32(float32_t val)
|
---|
250 | {
|
---|
251 | return float32_sinh(val);
|
---|
252 | }
|
---|
253 |
|
---|
254 | static inline float64_t sqrt_f64(float64_t val)
|
---|
255 | {
|
---|
256 | return float64_sqrt(val);
|
---|
257 | }
|
---|
258 |
|
---|
259 | static inline float32_t sqrt_f32(float32_t val)
|
---|
260 | {
|
---|
261 | return float32_sqrt(val);
|
---|
262 | }
|
---|
263 |
|
---|
264 | static inline float64_t tan_f64(float64_t val)
|
---|
265 | {
|
---|
266 | return float64_tan(val);
|
---|
267 | }
|
---|
268 |
|
---|
269 | static inline float32_t tan_f32(float32_t val)
|
---|
270 | {
|
---|
271 | return float32_tan(val);
|
---|
272 | }
|
---|
273 |
|
---|
274 | static inline float64_t tanh_f64(float64_t val)
|
---|
275 | {
|
---|
276 | return float64_tanh(val);
|
---|
277 | }
|
---|
278 |
|
---|
279 | static inline float32_t tanh_f32(float32_t val)
|
---|
280 | {
|
---|
281 | return float32_tanh(val);
|
---|
282 | }
|
---|
283 |
|
---|
284 | static inline float64_t trunc_f64(float64_t val)
|
---|
285 | {
|
---|
286 | return float64_trunc(val);
|
---|
287 | }
|
---|
288 |
|
---|
289 | static inline float32_t trunc_f32(float32_t val)
|
---|
290 | {
|
---|
291 | return float32_trunc(val);
|
---|
292 | }
|
---|
293 |
|
---|
294 | static inline float64_t acos(float64_t val)
|
---|
295 | {
|
---|
296 | return acos_f64(val);
|
---|
297 | }
|
---|
298 |
|
---|
299 | static inline float32_t acosf(float32_t val)
|
---|
300 | {
|
---|
301 | return acos_f32(val);
|
---|
302 | }
|
---|
303 |
|
---|
304 | static inline float64_t asin(float64_t val)
|
---|
305 | {
|
---|
306 | return asin_f64(val);
|
---|
307 | }
|
---|
308 |
|
---|
309 | static inline float32_t asinf(float32_t val)
|
---|
310 | {
|
---|
311 | return asin_f32(val);
|
---|
312 | }
|
---|
313 |
|
---|
314 | static inline float64_t atan(float64_t val)
|
---|
315 | {
|
---|
316 | return atan_f64(val);
|
---|
317 | }
|
---|
318 |
|
---|
319 | static inline float32_t atanf(float32_t val)
|
---|
320 | {
|
---|
321 | return atan_f32(val);
|
---|
322 | }
|
---|
323 |
|
---|
324 | static inline float64_t atan2(float64_t y, float64_t x)
|
---|
325 | {
|
---|
326 | return atan2_f64(y, x);
|
---|
327 | }
|
---|
328 |
|
---|
329 | static inline float32_t atan2f(float32_t y, float32_t x)
|
---|
330 | {
|
---|
331 | return atan2_f32(y, x);
|
---|
332 | }
|
---|
333 |
|
---|
334 | static inline float64_t ceil(float64_t val)
|
---|
335 | {
|
---|
336 | return ceil_f64(val);
|
---|
337 | }
|
---|
338 |
|
---|
339 | static inline float32_t ceilf(float32_t val)
|
---|
340 | {
|
---|
341 | return ceil_f32(val);
|
---|
342 | }
|
---|
343 |
|
---|
344 | static inline float64_t cos(float64_t val)
|
---|
345 | {
|
---|
346 | return cos_f64(val);
|
---|
347 | }
|
---|
348 |
|
---|
349 | static inline float32_t cosf(float32_t val)
|
---|
350 | {
|
---|
351 | return cos_f32(val);
|
---|
352 | }
|
---|
353 |
|
---|
354 | static inline float64_t cosh(float64_t val)
|
---|
355 | {
|
---|
356 | return cosh_f64(val);
|
---|
357 | }
|
---|
358 |
|
---|
359 | static inline float32_t coshf(float32_t val)
|
---|
360 | {
|
---|
361 | return cosh_f32(val);
|
---|
362 | }
|
---|
363 |
|
---|
364 | static inline float64_t exp(float64_t val)
|
---|
365 | {
|
---|
366 | return exp_f64(val);
|
---|
367 | }
|
---|
368 |
|
---|
369 | static inline float32_t expf(float32_t val)
|
---|
370 | {
|
---|
371 | return exp_f32(val);
|
---|
372 | }
|
---|
373 |
|
---|
374 | static inline float64_t fabs(float64_t val)
|
---|
375 | {
|
---|
376 | return fabs_f64(val);
|
---|
377 | }
|
---|
378 |
|
---|
379 | static inline float32_t fabsf(float32_t val)
|
---|
380 | {
|
---|
381 | return fabs_f32(val);
|
---|
382 | }
|
---|
383 |
|
---|
384 | static inline float64_t floor(float64_t val)
|
---|
385 | {
|
---|
386 | return floor_f64(val);
|
---|
387 | }
|
---|
388 |
|
---|
389 | static inline float32_t floorf(float32_t val)
|
---|
390 | {
|
---|
391 | return floor_f32(val);
|
---|
392 | }
|
---|
393 |
|
---|
394 | static inline float64_t fmod(float64_t dividend, float64_t divisor)
|
---|
395 | {
|
---|
396 | return fmod_f64(dividend, divisor);
|
---|
397 | }
|
---|
398 |
|
---|
399 | static inline float32_t fmodf(float32_t dividend, float32_t divisor)
|
---|
400 | {
|
---|
401 | return fmod_f32(dividend, divisor);
|
---|
402 | }
|
---|
403 |
|
---|
404 | static inline float64_t frexp(float64_t x, int *exp)
|
---|
405 | {
|
---|
406 | return frexp_f64(x, exp);
|
---|
407 | }
|
---|
408 |
|
---|
409 | static inline float32_t frexpf(float32_t x, int *exp)
|
---|
410 | {
|
---|
411 | return frexp_f32(x, exp);
|
---|
412 | }
|
---|
413 |
|
---|
414 | static inline float64_t ldexp(float64_t x, int exp)
|
---|
415 | {
|
---|
416 | return ldexp_f64(x, exp);
|
---|
417 | }
|
---|
418 |
|
---|
419 | static inline float32_t ldexpf(float32_t x, int exp)
|
---|
420 | {
|
---|
421 | return ldexp_f32(x, exp);
|
---|
422 | }
|
---|
423 |
|
---|
424 | static inline float64_t log(float64_t val)
|
---|
425 | {
|
---|
426 | return log_f64(val);
|
---|
427 | }
|
---|
428 |
|
---|
429 | static inline float32_t logf(float32_t val)
|
---|
430 | {
|
---|
431 | return log_f32(val);
|
---|
432 | }
|
---|
433 |
|
---|
434 | static inline float64_t log10(float64_t val)
|
---|
435 | {
|
---|
436 | return log10_f64(val);
|
---|
437 | }
|
---|
438 |
|
---|
439 | static inline float32_t log10f(float32_t val)
|
---|
440 | {
|
---|
441 | return log10_f32(val);
|
---|
442 | }
|
---|
443 |
|
---|
444 | static inline float64_t modf(float64_t value, float64_t *iptr)
|
---|
445 | {
|
---|
446 | return modf_f64(value, iptr);
|
---|
447 | }
|
---|
448 |
|
---|
449 | static inline float32_t modff(float32_t value, float32_t *iptr)
|
---|
450 | {
|
---|
451 | return modf_f32(value, iptr);
|
---|
452 | }
|
---|
453 |
|
---|
454 | static inline float64_t pow(float64_t x, float64_t y)
|
---|
455 | {
|
---|
456 | return pow_f64(x, y);
|
---|
457 | }
|
---|
458 |
|
---|
459 | static inline float32_t powf(float32_t x, float32_t y)
|
---|
460 | {
|
---|
461 | return pow_f32(x, y);
|
---|
462 | }
|
---|
463 |
|
---|
464 | static inline float64_t sin(float64_t val)
|
---|
465 | {
|
---|
466 | return sin_f64(val);
|
---|
467 | }
|
---|
468 |
|
---|
469 | static inline float32_t sinf(float32_t val)
|
---|
470 | {
|
---|
471 | return sin_f32(val);
|
---|
472 | }
|
---|
473 |
|
---|
474 | static inline float64_t sinh(float64_t val)
|
---|
475 | {
|
---|
476 | return sinh_f64(val);
|
---|
477 | }
|
---|
478 |
|
---|
479 | static inline float32_t sinhf(float32_t val)
|
---|
480 | {
|
---|
481 | return sinh_f32(val);
|
---|
482 | }
|
---|
483 |
|
---|
484 | static inline float64_t sqrt(float64_t val)
|
---|
485 | {
|
---|
486 | return sqrt_f64(val);
|
---|
487 | }
|
---|
488 |
|
---|
489 | static inline float32_t sqrtf(float32_t val)
|
---|
490 | {
|
---|
491 | return sqrt_f32(val);
|
---|
492 | }
|
---|
493 |
|
---|
494 | static inline float64_t tan(float64_t val)
|
---|
495 | {
|
---|
496 | return tan_f64(val);
|
---|
497 | }
|
---|
498 |
|
---|
499 | static inline float32_t tanf(float32_t val)
|
---|
500 | {
|
---|
501 | return tan_f32(val);
|
---|
502 | }
|
---|
503 |
|
---|
504 | static inline float64_t tanh(float64_t val)
|
---|
505 | {
|
---|
506 | return tanh_f64(val);
|
---|
507 | }
|
---|
508 |
|
---|
509 | static inline float32_t tanhf(float32_t val)
|
---|
510 | {
|
---|
511 | return tanh_f32(val);
|
---|
512 | }
|
---|
513 |
|
---|
514 | static inline float64_t trunc(float64_t val)
|
---|
515 | {
|
---|
516 | return trunc_f64(val);
|
---|
517 | }
|
---|
518 |
|
---|
519 | static inline float32_t truncf(float32_t val)
|
---|
520 | {
|
---|
521 | return trunc_f32(val);
|
---|
522 | }
|
---|
523 |
|
---|
524 | #endif
|
---|
525 |
|
---|
526 | /** @}
|
---|
527 | */
|
---|