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 libmathamd64
|
---|
31 | * @{
|
---|
32 | */
|
---|
33 | /** @file
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef LIBMATH_amd64_MATH_H_
|
---|
37 | #define LIBMATH_amd64_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 |
|
---|
49 | static inline float64_t ceil_f64(float64_t val)
|
---|
50 | {
|
---|
51 | return float64_ceil(val);
|
---|
52 | }
|
---|
53 |
|
---|
54 | static inline float32_t ceil_f32(float32_t val)
|
---|
55 | {
|
---|
56 | return float32_ceil(val);
|
---|
57 | }
|
---|
58 |
|
---|
59 | extern float64_t cos_f64(float64_t);
|
---|
60 |
|
---|
61 | static inline float32_t cos_f32(float32_t val)
|
---|
62 | {
|
---|
63 | return (float32_t)cos_f64((float64_t)val);
|
---|
64 | }
|
---|
65 |
|
---|
66 | static inline float64_t exp_f64(float64_t val)
|
---|
67 | {
|
---|
68 | return float64_exp(val);
|
---|
69 | }
|
---|
70 |
|
---|
71 | static inline float32_t exp_f32(float32_t val)
|
---|
72 | {
|
---|
73 | return float32_exp(val);
|
---|
74 | }
|
---|
75 |
|
---|
76 | static inline float64_t floor_f64(float64_t val)
|
---|
77 | {
|
---|
78 | return float64_floor(val);
|
---|
79 | }
|
---|
80 |
|
---|
81 | static inline float32_t floor_f32(float32_t val)
|
---|
82 | {
|
---|
83 | return float32_floor(val);
|
---|
84 | }
|
---|
85 |
|
---|
86 | static inline float64_t fmod_f64(float64_t dividend, float64_t divisor)
|
---|
87 | {
|
---|
88 | return float64_mod(dividend, divisor);
|
---|
89 | }
|
---|
90 |
|
---|
91 | static inline float64_t fmod_f32(float32_t dividend, float32_t divisor)
|
---|
92 | {
|
---|
93 | return float32_mod(dividend, divisor);
|
---|
94 | }
|
---|
95 |
|
---|
96 | static inline float64_t log_f64(float64_t val)
|
---|
97 | {
|
---|
98 | return float64_log(val);
|
---|
99 | }
|
---|
100 |
|
---|
101 | static inline float32_t log_f32(float32_t val)
|
---|
102 | {
|
---|
103 | return float32_log(val);
|
---|
104 | }
|
---|
105 |
|
---|
106 | static inline float64_t pow_f64(float64_t x, float64_t y)
|
---|
107 | {
|
---|
108 | return float64_pow(x, y);
|
---|
109 | }
|
---|
110 |
|
---|
111 | static inline float32_t pow_f32(float32_t x, float32_t y)
|
---|
112 | {
|
---|
113 | return float32_pow(x, y);
|
---|
114 | }
|
---|
115 |
|
---|
116 | extern float64_t sin_f64(float64_t);
|
---|
117 |
|
---|
118 | static inline float32_t sin_f32(float32_t val)
|
---|
119 | {
|
---|
120 | return (float32_t)sin_f64((float64_t)val);
|
---|
121 | }
|
---|
122 |
|
---|
123 | extern float64_t trunc_f64(float64_t);
|
---|
124 |
|
---|
125 | static inline float32_t trunc_f32(float32_t val)
|
---|
126 | {
|
---|
127 | return (float32_t)trunc_f64((float64_t)val);
|
---|
128 | }
|
---|
129 |
|
---|
130 | static inline float64_t ceil(float64_t val)
|
---|
131 | {
|
---|
132 | return ceil_f64(val);
|
---|
133 | }
|
---|
134 |
|
---|
135 | static inline float32_t ceilf(float32_t val)
|
---|
136 | {
|
---|
137 | return ceil_f32(val);
|
---|
138 | }
|
---|
139 |
|
---|
140 | static inline float64_t cos(float64_t val)
|
---|
141 | {
|
---|
142 | return cos_f64(val);
|
---|
143 | }
|
---|
144 |
|
---|
145 | static inline float32_t cosf(float32_t val)
|
---|
146 | {
|
---|
147 | return cos_f32(val);
|
---|
148 | }
|
---|
149 |
|
---|
150 | static inline float64_t exp(float64_t val)
|
---|
151 | {
|
---|
152 | return exp_f64(val);
|
---|
153 | }
|
---|
154 |
|
---|
155 | static inline float32_t expf(float32_t val)
|
---|
156 | {
|
---|
157 | return exp_f32(val);
|
---|
158 | }
|
---|
159 |
|
---|
160 | static inline float64_t floor(float64_t val)
|
---|
161 | {
|
---|
162 | return floor_f64(val);
|
---|
163 | }
|
---|
164 |
|
---|
165 | static inline float32_t floorf(float32_t val)
|
---|
166 | {
|
---|
167 | return floor_f32(val);
|
---|
168 | }
|
---|
169 |
|
---|
170 | static inline float64_t fmod(float64_t dividend, float64_t divisor)
|
---|
171 | {
|
---|
172 | return fmod_f64(dividend, divisor);
|
---|
173 | }
|
---|
174 |
|
---|
175 | static inline float32_t fmodf(float32_t dividend, float32_t divisor)
|
---|
176 | {
|
---|
177 | return fmod_f32(dividend, divisor);
|
---|
178 | }
|
---|
179 |
|
---|
180 | static inline float64_t log(float64_t val)
|
---|
181 | {
|
---|
182 | return log_f64(val);
|
---|
183 | }
|
---|
184 |
|
---|
185 | static inline float32_t logf(float32_t val)
|
---|
186 | {
|
---|
187 | return log_f32(val);
|
---|
188 | }
|
---|
189 |
|
---|
190 | static inline float64_t pow(float64_t x, float64_t y)
|
---|
191 | {
|
---|
192 | return pow_f64(x, y);
|
---|
193 | }
|
---|
194 |
|
---|
195 | static inline float32_t powf(float32_t x, float32_t y)
|
---|
196 | {
|
---|
197 | return pow_f32(x, y);
|
---|
198 | }
|
---|
199 |
|
---|
200 | static inline float64_t sin(float64_t val)
|
---|
201 | {
|
---|
202 | return sin_f64(val);
|
---|
203 | }
|
---|
204 |
|
---|
205 | static inline float32_t sinf(float32_t val)
|
---|
206 | {
|
---|
207 | return sin_f32(val);
|
---|
208 | }
|
---|
209 |
|
---|
210 | static inline float64_t trunc(float64_t val)
|
---|
211 | {
|
---|
212 | return trunc_f64(val);
|
---|
213 | }
|
---|
214 |
|
---|
215 | static inline float32_t truncf(float32_t val)
|
---|
216 | {
|
---|
217 | return trunc_f32(val);
|
---|
218 | }
|
---|
219 |
|
---|
220 | #endif
|
---|
221 |
|
---|
222 | /** @}
|
---|
223 | */
|
---|