Loading...
Searching...
No Matches
1#ifndef SRC_COMMON_DECIMAL_HPP_
2#define SRC_COMMON_DECIMAL_HPP_
11#ifdef FOUND_FLOAT_MODE
12 typedef float decimal;
13 #define STR_TO_DECIMAL(x) std::stof(x)
15 typedef double decimal;
16 #define STR_TO_DECIMAL(x) std::stod(x)
25#define DECIMAL(x) (static_cast<decimal>(x))
28#define DECIMAL_M_E (DECIMAL(M_E))
29#define DECIMAL_M_LOG2E (DECIMAL(M_LOG2E))
30#define DECIMAL_M_LOG10E (DECIMAL(M_LOG10E))
31#define DECIMAL_M_LN2 (DECIMAL(M_LN2))
32#define DECIMAL_M_LN10 (DECIMAL(M_LN10))
33#define DECIMAL_M_PI (DECIMAL(M_PI))
34#define DECIMAL_M_PI_2 (DECIMAL(M_PI_2))
35#define DECIMAL_M_PI_4 (DECIMAL(M_PI_4))
36#define DECIMAL_M_1_PI (DECIMAL(M_1_PI))
37#define DECIMAL_M_2_PI (DECIMAL(M_2_PI))
38#define DECIMAL_M_2_SQRTPI (DECIMAL(M_2_SQRTPI))
39#define DECIMAL_M_SQRT2 (DECIMAL(M_SQRT2))
40#define DECIMAL_M_SQRT1_2 (DECIMAL(M_SQRT1_2))
41#define DECIMAL_M_R_E (DECIMAL(6371008.7714))
42#define DECIMAL_INF (DECIMAL(INFINITY))
45#ifdef FOUND_FLOAT_MODE
46 #define DECIMAL_TOLERANCE (DECIMAL(1e-3))
48 #define DECIMAL_TOLERANCE (DECIMAL(1e-6))
52#define DECIMAL_POW(base,power) (DECIMAL(std::pow(base, power)))
53#define DECIMAL_SQRT(x) (DECIMAL(std::sqrt(x)))
54#define DECIMAL_LOG(x) (DECIMAL(std::log(x)))
55#define DECIMAL_EXP(x) (DECIMAL(std::exp(x)))
56#define DECIMAL_ERF(x) (DECIMAL(std::erf(x)))
59#define DECIMAL_ROUND(x) (DECIMAL(std::round(x)))
60#define DECIMAL_CEIL(x) (DECIMAL(std::ceil(x)))
61#define DECIMAL_FLOOR(x) (DECIMAL(std::floor(x)))
62#define DECIMAL_ABS(x) (DECIMAL(std::abs(x)))
65#define DECIMAL_SIN(x) (DECIMAL(std::sin(x)))
66#define DECIMAL_COS(x) (DECIMAL(std::cos(x)))
67#define DECIMAL_TAN(x) (DECIMAL(std::tan(x)))
68#define DECIMAL_ASIN(x) (DECIMAL(std::asin(x)))
69#define DECIMAL_ACOS(x) (DECIMAL(std::acos(x)))
70#define DECIMAL_ATAN(x) (DECIMAL(std::atan(x)))
71#define DECIMAL_ATAN2(x,y) (DECIMAL(std::atan2(x,y)))
74#define DECIMAL_FMA(x,y,z) (DECIMAL(std::fma(x),y,z))
75#define DECIMAL_HYPOT(x,y) (DECIMAL(std::hypot(x),y))