|
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 uint64_t | fibonacci (const uint32_t n) |
| | 计算斐波那契数
|
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 uint64_t | leonardo (const uint32_t n) |
| | 计算莱昂纳多数
|
| template<typename T> |
| MSTL_PURE_FUNCTION constexpr T | angular2radian (const T angular) noexcept |
| | 角度转弧度
|
| template<typename T> |
| MSTL_PURE_FUNCTION constexpr T | radian2angular (const T radian) noexcept |
| | 弧度转角度
|
| template<typename T> |
| MSTL_CONST_FUNCTION constexpr enable_if_t< is_signed_v< T >, T > | absolute (const T x) noexcept |
| | 取绝对值(有符号数版本)
|
| template<typename T> |
| MSTL_CONST_FUNCTION constexpr enable_if_t< is_unsigned_v< T >, T > | absolute (const T x) noexcept |
| | 取绝对值(无符号数版本)
|
| template<typename T> |
| MSTL_CONST_FUNCTION constexpr const T & | sum (const T &x) noexcept |
| | 单参数求和
|
| template<typename First, typename... Rests, enable_if_t<(sizeof...(Rests) > 0), int > = 0> |
| MSTL_CONST_FUNCTION constexpr decltype(auto) | sum (First first, Rests... args) |
| | 多参数求和
|
| template<typename... Args, enable_if_t<(sizeof...(Args) > 0), int > = 0> |
| MSTL_CONST_FUNCTION constexpr decltype(auto) | average (Args... args) |
| | 计算平均值
|
| template<typename T> |
| MSTL_CONSTEXPR14 int | sign (const T &value) noexcept |
| | 获取数值的符号
|
| template<typename T> |
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 T | gcd (const T &m, const T &n) noexcept |
| | 计算最大公约数
|
| template<typename T> |
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 T | lcm (const T &m, const T &n) noexcept |
| | 计算最小公倍数
|
| template<typename T> |
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 T | float_mod (const T x, const T y) |
| | 浮点数取模运算
|
| template<typename T> |
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 T | power (const T &x, uint32_t n) noexcept |
| | 幂运算
|
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 decimal_t | exponential (const uint32_t n) noexcept |
| | 计算e的n次幂
|
| template<typename T> |
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 T | logarithm_e (const T x) noexcept |
| | 计算自然对数
|
| template<typename T> |
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 T | logarithm (const T x, const uint32_t base) |
| | 计算任意底数的对数
|
| template<typename T> |
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 T | logarithm_2 (const T x) |
| | 计算以2为底的对数
|
| template<typename T> |
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 T | logarithm_10 (const T x) |
| | 计算以10为底的对数
|
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 decimal_t | square_root (const decimal_t x, const decimal_t precise=_CONSTANTS PRECISE_TOLERANCE) noexcept |
| | 计算平方根
|
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 decimal_t | cube_root (const decimal_t x, const decimal_t precise=_CONSTANTS PRECISE_TOLERANCE) noexcept |
| | 计算立方根
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 uint64_t | factorial (const uint32_t n) noexcept |
| | 计算阶乘
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | floor_bit (const decimal_t x, const uint32_t bit) noexcept |
| | 向下舍入到指定位数
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | ceil_bit (const decimal_t x, const uint32_t bit) noexcept |
| | 向上舍入到指定位数
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | round_bit (const decimal_t x, const uint32_t bit) noexcept |
| | 四舍五入到指定位数
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | truncate_bit (const decimal_t x, const uint32_t bit) noexcept |
| | 截断到指定位数
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | floor (const decimal_t x) noexcept |
| | 向下取整
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | floor (const decimal_t x, const uint32_t bit) noexcept |
| | 向下取整到指定位数
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | ceil (const decimal_t x) noexcept |
| | 向上取整
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | ceil (const decimal_t x, const uint32_t bit) noexcept |
| | 向上取整到指定位数
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | round (const decimal_t x) noexcept |
| | 四舍五入
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | round (const decimal_t x, const uint32_t bit) noexcept |
| | 四舍五入到指定位数
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | truncate (const decimal_t x, const int bit) noexcept |
| | 截断
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | truncate (const decimal_t x) noexcept |
| | 截断到整数位
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 bool | around_multiple (const decimal_t x, const decimal_t axis, const decimal_t toler=_CONSTANTS PRECISE_TOLERANCE) |
| | 判断是否接近某个倍数值
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 bool | around_pi (const decimal_t x, const decimal_t toler=_CONSTANTS LOW_PRECISE_TOLERANCE) |
| | 判断是否接近π的整数倍
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 bool | around_zero (const decimal_t x, const decimal_t toler=_CONSTANTS PRECISE_TOLERANCE) |
| | 判断是否接近零
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | remainder (const decimal_t x, const decimal_t y) noexcept |
| | 计算余数
|
| MSTL_CONST_FUNCTION constexpr decimal_t | float_part (const decimal_t x) noexcept |
| | 获取小数部分
|
| MSTL_CONST_FUNCTION MSTL_CONSTEXPR14 decimal_t | float_apart (decimal_t x, int64_t *int_ptr) noexcept |
| | 分离整数和小数部分
|
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 decimal_t | sine (decimal_t x) noexcept |
| | 计算正弦值
|
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 decimal_t | cosine (const decimal_t x) noexcept |
| | 计算余弦值
|
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 decimal_t | tangent (const decimal_t x) |
| | 计算正切值
|
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 decimal_t | cotangent (const decimal_t x) |
| | 计算余切值
|
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 decimal_t | arctangent (const decimal_t x) noexcept |
| | 计算反正切值
|
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 decimal_t | arcsine (const decimal_t x) |
| | 计算反正弦值
|
| MSTL_PURE_FUNCTION MSTL_CONSTEXPR14 decimal_t | arccosine (const decimal_t x) |
| | 计算反余弦值
|
MSTL数学函数库
此文件提供了MSTL库的数学函数和常量定义, 包括基本数学运算、三角函数、对数函数、数值计算等常用数学功能。
在文件 math.hpp 中定义.