3 @brief mathematical algorithm library
14 @addtogroup A_MATH mathematical algorithm library
19 #define A_E 2.71828182845904523536
20 /*! \f$ \log_{2}{e}=\frac{1}{\ln{2}} \f$ */
21 #define A_LOG2E 1.44269504088896340736
22 /*! \f$ \lg{e}=\frac{1}{\ln{2}+\ln{5}} \f$ */
23 #define A_LOG10E 0.434294481903251827651
25 #define A_LN2 0.693147180559945309417
26 /*! \f$ \frac{1}{\ln{2}} \f$ */
27 #define A_LN1_2 3.32192809488736218171
28 /*! \f$ \ln{10} \f$ */
29 #define A_LN10 2.30258509299404568402
30 /*! \f$ \frac{1}{\ln{10}} \f$ */
31 #define A_LN1_10 0.434294481903251827651
33 #define A_PI 3.14159265358979323846
35 #define A_TAU 6.28318530717958647693
36 /*! \f$ \frac{\pi}{2} \f$ */
37 #define A_PI_2 1.57079632679489661923
38 /*! \f$ \frac{\pi}{4} \f$ */
39 #define A_PI_4 0.785398163397448309616
40 /*! \f$ \frac{1}{\pi} \f$ */
41 #define A_1_PI 0.318309886183790671538
42 /*! \f$ \frac{2}{\pi} \f$ */
43 #define A_2_PI 0.636619772367581343076
44 /*! \f$ \frac{1}{2\pi} \f$ */
45 #define A_1_TAU 0.159154943091895335769
46 /*! \f$ \frac{2}{\sqrt{\pi}} \f$ */
47 #define A_2_SQRTPI 1.12837916709551257390
48 /*! \f$ \sqrt{2} \f$ */
49 #define A_SQRT2 1.41421356237309504880
50 /*! \f$ \frac{1}{\sqrt{2}}=\frac{\sqrt{2}}{2} \f$ */
51 #define A_SQRT1_2 0.707106781186547524401
52 /*! \f$ \sqrt{3} \f$ */
53 #define A_SQRT3 1.73205080756887729352
54 /*! \f$ \frac{1}{\sqrt{3}}=\frac{\sqrt{3}}{3} \f$ */
55 #define A_SQRT1_3 0.57735026918962576450
57 #if defined(__cplusplus)
59 #endif /* __cplusplus */
62 @brief reciprocal of square-root, \f$ \frac{1}{\sqrt{x}} \f$
63 @details http://en.wikipedia.org/wiki/Fast_inverse_square_root
64 @param[in] x independent variable
65 @return calculated result
67 A_EXTERN a_f32
a_f32_rsqrt(a_f32 x
);
68 A_EXTERN a_f64
a_f64_rsqrt(a_f64 x
);
71 @brief square root of an unsigned integer
72 @param[in] x independent variable
73 @return calculated result
75 A_EXTERN a_u16
a_u32_sqrt(a_u32 x
);
76 A_EXTERN a_u32
a_u64_sqrt(a_u64 x
);
78 #if defined(__cplusplus)
80 #endif /* __cplusplus */
82 #define a_f32_modf A_F32_F(modf)
83 #define a_f32_frexp A_F32_F(frexp)
84 #define a_f32_ldexp A_F32_F(ldexp)
85 #define a_f32_scalbn A_F32_F(scalbn)
86 #define a_f32_scalbln A_F32_F(scalbln)
87 #define a_f32_nextafter A_F32_F(nextafter)
88 #define a_f32_nexttoward A_F32_F(nexttoward)
89 #define a_f32_copysign A_F32_F(copysign)
91 #define a_f32_ma A_F32_F(fma)
92 #define a_f32_nan A_F32_F(nan)
93 #define a_f32_abs A_F32_F(fabs)
94 #define a_f32_mod A_F32_F(fmod)
95 #define a_f32_max A_F32_F(fmax)
96 #define a_f32_min A_F32_F(fmin)
97 #define a_f32_dim A_F32_F(fdim)
98 #define a_f32_remquo A_F32_F(remquo)
99 #define a_f32_remainder A_F32_F(remainder)
101 #define a_f32_exp A_F32_F(exp)
102 #define a_f32_exp2 A_F32_F(exp2)
103 #define a_f32_expm1 A_F32_F(expm1)
105 #define a_f32_log A_F32_F(log)
106 #define a_f32_logb A_F32_F(logb)
107 #define a_f32_log2 A_F32_F(log2)
108 #define a_f32_log10 A_F32_F(log10)
109 #define a_f32_log1p A_F32_F(log1p)
110 #define a_f32_ilogb A_F32_F(ilogb)
112 #define a_f32_pow A_F32_F(pow)
113 #define a_f32_sqrt A_F32_F(sqrt)
114 #define a_f32_cbrt A_F32_F(cbrt)
115 #define a_f32_hypot A_F32_F(hypot)
117 #define a_f32_sin A_F32_F(sin)
118 #define a_f32_cos A_F32_F(cos)
119 #define a_f32_tan A_F32_F(tan)
120 #define a_f32_asin A_F32_F(asin)
121 #define a_f32_acos A_F32_F(acos)
122 #define a_f32_atan A_F32_F(atan)
123 #define a_f32_atan2 A_F32_F(atan2)
125 #define a_f32_sinh A_F32_F(sinh)
126 #define a_f32_cosh A_F32_F(cosh)
127 #define a_f32_tanh A_F32_F(tanh)
128 #define a_f32_asinh A_F32_F(asinh)
129 #define a_f32_acosh A_F32_F(acosh)
130 #define a_f32_atanh A_F32_F(atanh)
132 #define a_f32_erf A_F32_F(erf)
133 #define a_f32_erfc A_F32_F(erfc)
134 #define a_f32_tgamma A_F32_F(tgamma)
135 #define a_f32_lgamma A_F32_F(lgamma)
137 #define a_f32_ceil A_F32_F(ceil)
138 #define a_f32_floor A_F32_F(floor)
139 #define a_f32_trunc A_F32_F(trunc)
140 #define a_f32_round A_F32_F(round)
141 #define a_f32_lround A_F32_F(lround)
142 #define a_f32_llround A_F32_F(llround)
143 #define a_f32_nearbyint A_F32_F(nearbyint)
144 #define a_f32_rint A_F32_F(rint)
145 #define a_f32_lrintt A_F32_F(lrint)
146 #define a_f32_llrintt A_F32_F(llrint)
148 #define a_f64_modf A_F64_F(modf)
149 #define a_f64_frexp A_F64_F(frexp)
150 #define a_f64_ldexp A_F64_F(ldexp)
151 #define a_f64_scalbn A_F64_F(scalbn)
152 #define a_f64_scalbln A_F64_F(scalbln)
153 #define a_f64_nextafter A_F64_F(nextafter)
154 #define a_f64_nexttoward A_F64_F(nexttoward)
155 #define a_f64_copysign A_F64_F(copysign)
157 #define a_f64_ma A_F64_F(fma)
158 #define a_f64_nan A_F64_F(nan)
159 #define a_f64_abs A_F64_F(fabs)
160 #define a_f64_mod A_F64_F(fmod)
161 #define a_f64_max A_F64_F(fmax)
162 #define a_f64_min A_F64_F(fmin)
163 #define a_f64_dim A_F64_F(fdim)
164 #define a_f64_remquo A_F64_F(remquo)
165 #define a_f64_remainder A_F64_F(remainder)
167 #define a_f64_exp A_F64_F(exp)
168 #define a_f64_exp2 A_F64_F(exp2)
169 #define a_f64_expm1 A_F64_F(expm1)
171 #define a_f64_log A_F64_F(log)
172 #define a_f64_logb A_F64_F(logb)
173 #define a_f64_log2 A_F64_F(log2)
174 #define a_f64_log10 A_F64_F(log10)
175 #define a_f64_log1p A_F64_F(log1p)
176 #define a_f64_ilogb A_F64_F(ilogb)
178 #define a_f64_pow A_F64_F(pow)
179 #define a_f64_sqrt A_F64_F(sqrt)
180 #define a_f64_cbrt A_F64_F(cbrt)
181 #define a_f64_hypot A_F64_F(hypot)
183 #define a_f64_sin A_F64_F(sin)
184 #define a_f64_cos A_F64_F(cos)
185 #define a_f64_tan A_F64_F(tan)
186 #define a_f64_asin A_F64_F(asin)
187 #define a_f64_acos A_F64_F(acos)
188 #define a_f64_atan A_F64_F(atan)
189 #define a_f64_atan2 A_F64_F(atan2)
191 #define a_f64_sinh A_F64_F(sinh)
192 #define a_f64_cosh A_F64_F(cosh)
193 #define a_f64_tanh A_F64_F(tanh)
194 #define a_f64_asinh A_F64_F(asinh)
195 #define a_f64_acosh A_F64_F(acosh)
196 #define a_f64_atanh A_F64_F(atanh)
198 #define a_f64_erf A_F64_F(erf)
199 #define a_f64_erfc A_F64_F(erfc)
200 #define a_f64_tgamma A_F64_F(tgamma)
201 #define a_f64_lgamma A_F64_F(lgamma)
203 #define a_f64_ceil A_F64_F(ceil)
204 #define a_f64_floor A_F64_F(floor)
205 #define a_f64_trunc A_F64_F(trunc)
206 #define a_f64_round A_F64_F(round)
207 #define a_f64_lround A_F64_F(lround)
208 #define a_f64_llround A_F64_F(llround)
209 #define a_f64_nearbyint A_F64_F(nearbyint)
210 #define a_f64_rint A_F64_F(rint)
211 #define a_f64_lrintt A_F64_F(lrint)
212 #define a_f64_llrintt A_F64_F(llrint)
218 @addtogroup A_FLOAT floating-point number
223 #define A_FLOAT_E A_FLOAT_C(A_E)
224 /*! \f$ \log_{2}{e}=\frac{1}{\ln{2}} \f$ */
225 #define A_FLOAT_LOG2E A_FLOAT_C(A_LOG2E)
226 /*! \f$ \lg{e}=\frac{1}{\ln{2}+\ln{5}} \f$ */
227 #define A_FLOAT_LOG10E A_FLOAT_C(A_LOG10E)
228 /*! \f$ \ln{2} \f$ */
229 #define A_FLOAT_LN2 A_FLOAT_C(A_LN2)
230 /*! \f$ \frac{1}{\ln{2}} \f$ */
231 #define A_FLOAT_LN1_2 A_FLOAT_C(A_LN1_2)
232 /*! \f$ \ln{10} \f$ */
233 #define A_FLOAT_LN10 A_FLOAT_C(A_LN10)
234 /*! \f$ \frac{1}{\ln{10}} \f$ */
235 #define A_FLOAT_LN1_10 A_FLOAT_C(A_LN1_10)
237 #define A_FLOAT_PI A_FLOAT_C(A_PI)
239 #define A_FLOAT_TAU A_FLOAT_C(A_TAU)
240 /*! \f$ \frac{\pi}{2} \f$ */
241 #define A_FLOAT_PI_2 A_FLOAT_C(A_PI_2)
242 /*! \f$ \frac{\pi}{4} \f$ */
243 #define A_FLOAT_PI_4 A_FLOAT_C(A_PI_4)
244 /*! \f$ \frac{1}{\pi} \f$ */
245 #define A_FLOAT_1_PI A_FLOAT_C(A_1_PI)
246 /*! \f$ \frac{2}{\pi} \f$ */
247 #define A_FLOAT_2_PI A_FLOAT_C(A_2_PI)
248 /*! \f$ \frac{1}{2\pi} \f$ */
249 #define A_FLOAT_1_TAU A_FLOAT_C(A_1_TAU)
250 /*! \f$ \frac{2}{\sqrt{\pi}} \f$ */
251 #define A_FLOAT_2_SQRTPI A_FLOAT_C(A_2_SQRTPI)
252 /*! \f$ \sqrt{2} \f$ */
253 #define A_FLOAT_SQRT2 A_FLOAT_C(A_SQRT2)
254 /*! \f$ \frac{1}{\sqrt{2}}=\frac{\sqrt{2}}{2} \f$ */
255 #define A_FLOAT_SQRT1_2 A_FLOAT_C(A_SQRT1_2)
256 /*! \f$ \sqrt{3} \f$ */
257 #define A_FLOAT_SQRT3 A_FLOAT_C(A_SQRT3)
258 /*! \f$ \frac{1}{\sqrt{3}}=\frac{\sqrt{3}}{3} \f$ */
259 #define A_FLOAT_SQRT1_3 A_FLOAT_C(A_SQRT1_3)
261 #if defined(__cplusplus)
263 #endif /* __cplusplus */
265 A_EXTERN a_float
a_float_expm1(a_float x
);
266 A_EXTERN a_float
a_float_log1p(a_float x
);
267 A_EXTERN a_float
a_float_atan2(a_float x
, a_float y
);
268 A_EXTERN a_float
a_float_hypot(a_float x
, a_float y
);
269 A_EXTERN a_float
a_float_hypot3(a_float x
, a_float y
, a_float z
);
271 #if defined(__cplusplus)
273 #endif /* __cplusplus */
275 #define a_float_modf A_FLOAT_F(modf)
276 #define a_float_frexp A_FLOAT_F(frexp)
277 #define a_float_ldexp A_FLOAT_F(ldexp)
278 #define a_float_scalbn A_FLOAT_F(scalbn)
279 #define a_float_scalbln A_FLOAT_F(scalbln)
280 #define a_float_nextafter A_FLOAT_F(nextafter)
281 #define a_float_nexttoward A_FLOAT_F(nexttoward)
282 #define a_float_copysign A_FLOAT_F(copysign)
284 #define a_float_ma A_FLOAT_F(fma)
285 #define a_float_nan A_FLOAT_F(nan)
286 #define a_float_abs A_FLOAT_F(fabs)
287 #define a_float_mod A_FLOAT_F(fmod)
288 #define a_float_max A_FLOAT_F(fmax)
289 #define a_float_min A_FLOAT_F(fmin)
290 #define a_float_dim A_FLOAT_F(fdim)
291 #define a_float_remquo A_FLOAT_F(remquo)
292 #define a_float_remainder A_FLOAT_F(remainder)
294 #define a_float_exp A_FLOAT_F(exp)
295 #define a_float_exp2 A_FLOAT_F(exp2)
296 #if defined(A_HAVE_EXPM1) && (A_HAVE_EXPM1 + 0 > 0)
297 #define a_float_expm1 A_FLOAT_F(expm1)
298 #endif /* A_HAVE_EXPM1 */
300 #define a_float_log A_FLOAT_F(log)
301 #define a_float_logb A_FLOAT_F(logb)
302 #define a_float_log2 A_FLOAT_F(log2)
303 #define a_float_log10 A_FLOAT_F(log10)
304 #if defined(A_HAVE_LOG1P) && (A_HAVE_LOG1P + 0 > 0)
305 #define a_float_log1p A_FLOAT_F(log1p)
306 #endif /* A_HAVE_LOG1P */
307 #define a_float_ilogb A_FLOAT_F(ilogb)
309 #define a_float_pow A_FLOAT_F(pow)
310 #define a_float_sqrt A_FLOAT_F(sqrt)
311 #define a_float_cbrt A_FLOAT_F(cbrt)
312 #if defined(A_HAVE_HYPOT) && (A_HAVE_HYPOT + 0 > 0)
313 #define a_float_hypot A_FLOAT_F(hypot)
314 #endif /* A_HAVE_HYPOT */
316 #define a_float_sin A_FLOAT_F(sin)
317 #define a_float_cos A_FLOAT_F(cos)
318 #define a_float_tan A_FLOAT_F(tan)
319 #define a_float_asin A_FLOAT_F(asin)
320 #define a_float_acos A_FLOAT_F(acos)
321 #define a_float_atan A_FLOAT_F(atan)
322 #if defined(A_HAVE_ATAN2) && (A_HAVE_ATAN2 + 0 > 0)
323 #define a_float_atan2 A_FLOAT_F(atan2)
324 #endif /* A_HAVE_ATAN2 */
326 #define a_float_sinh A_FLOAT_F(sinh)
327 #define a_float_cosh A_FLOAT_F(cosh)
328 #define a_float_tanh A_FLOAT_F(tanh)
329 #define a_float_asinh A_FLOAT_F(asinh)
330 #define a_float_acosh A_FLOAT_F(acosh)
331 #define a_float_atanh A_FLOAT_F(atanh)
333 #define a_float_erf A_FLOAT_F(erf)
334 #define a_float_erfc A_FLOAT_F(erfc)
335 #define a_float_tgamma A_FLOAT_F(tgamma)
336 #define a_float_lgamma A_FLOAT_F(lgamma)
338 #define a_float_ceil A_FLOAT_F(ceil)
339 #define a_float_floor A_FLOAT_F(floor)
340 #define a_float_trunc A_FLOAT_F(trunc)
341 #define a_float_round A_FLOAT_F(round)
342 #define a_float_lround A_FLOAT_F(lround)
343 #define a_float_llround A_FLOAT_F(llround)
344 #define a_float_nearbyint A_FLOAT_F(nearbyint)
345 #define a_float_rint A_FLOAT_F(rint)
346 #define a_float_lrintt A_FLOAT_F(lrint)
347 #define a_float_llrintt A_FLOAT_F(llrint)
351 #endif /* a/math.h */