LMMC
Lamina Mathematic core
载入中...
搜索中...
未找到
config.h
浏览该文件的文档.
1
9#ifndef LMMC_CONFIG_H
10#define LMMC_CONFIG_H
11
12#include <math.h>
13
14/* C++ expansion must not resolve libm calls in the caller's namespace. */
15#ifdef __cplusplus
16#define LMMC_LIBM(function) ::function
17#else
18#define LMMC_LIBM(function) function
19#endif
20
28typedef double lmmc_real_t;
29
31#define LMMC_PRI_REAL "f"
33#define LMMC_SCN_REAL "lf"
34
36#define LMMC_REAL_INIT(x) ((void)0)
38#define LMMC_REAL_CLEAR(x) ((void)0)
39
41#define LMMC_REAL_SET(dst, src) (*(dst) = *(src))
43#define LMMC_REAL_SET_D(dst, dbl) (*(dst) = (dbl))
44
46#define LMMC_REAL_ADD(res, a, b) (*(res) = *(a) + *(b))
48#define LMMC_REAL_SUB(res, a, b) (*(res) = *(a) - *(b))
50#define LMMC_REAL_MUL(res, a, b) (*(res) = *(a) * *(b))
52#define LMMC_REAL_DIV(res, a, b) (*(res) = *(a) / *(b))
53
55#define LMMC_REAL_NEG(res, a) (*(res) = -*(a))
57#define LMMC_REAL_SQRT(res, a) (*(res) = LMMC_LIBM(sqrt)(*(a)))
59#define LMMC_REAL_ABS(res, a) (*(res) = LMMC_LIBM(fabs)(*(a)))
60
62#define LMMC_REAL_EXP(res, a) (*(res) = LMMC_LIBM(exp)(*(a)))
64#define LMMC_REAL_LOG(res, a) (*(res) = LMMC_LIBM(log)(*(a)))
66#define LMMC_REAL_SIN(res, a) (*(res) = LMMC_LIBM(sin)(*(a)))
68#define LMMC_REAL_COS(res, a) (*(res) = LMMC_LIBM(cos)(*(a)))
70#define LMMC_REAL_TAN(res, a) (*(res) = LMMC_LIBM(tan)(*(a)))
71
73#define LMMC_REAL_COSH(res, a) (*(res) = LMMC_LIBM(cosh)(*(a)))
75#define LMMC_REAL_SINH(res, a) (*(res) = LMMC_LIBM(sinh)(*(a)))
77#define LMMC_REAL_ATAN2(res, y, x) (*(res) = LMMC_LIBM(atan2)(*(y), *(x)))
78
80#define LMMC_REAL_CMP(a, b) ((*(a) > *(b)) ? 1 : ((*(a) < *(b)) ? -1 : 0))
82#define LMMC_REAL_IS_FINITE(x) LMMC_LIBM(isfinite)(*(x))
83
85#define LMMC_REAL_EPSILON ((lmmc_real_t)1e-15)
87#define LMMC_CONST_PI ((lmmc_real_t)3.14159265358979323846)
88
89#endif
double lmmc_real_t
Public and internal LMMC real type.