source: mainline/uspace/lib/math/arch/ia32/include/libarch/math.h@ b69786e

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

Add all functions required by C89 plus their single-precision variants from C99.

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