|
| constexpr uint64_t | neforce::safe_decimal_to_uint64 (const decimal_t x) noexcept |
| | 将非负 decimal_t 安全转换为 uint64_t(避免 >= 2^63 时的 UB)
|
| constexpr uint64_t | neforce::fibonacci (const uint32_t n) noexcept |
| | 计算斐波那契数
|
| constexpr uint64_t | neforce::leonardo (const uint32_t n) noexcept |
| | 计算莱昂纳多数
|
| template<typename T> |
| constexpr T | neforce::angular2radian (const T angular) noexcept |
| | 角度转弧度
|
| template<typename T> |
| constexpr T | neforce::radian2angular (const T radian) noexcept |
| | 弧度转角度
|
| template<typename T> |
| constexpr enable_if_t< is_signed_v< T >, T > | neforce::absolute (const T x) noexcept |
| | 取绝对值(有符号数版本)
|
| template<typename T> |
| constexpr enable_if_t< is_unsigned_v< T >, T > | neforce::absolute (const T x) noexcept |
| | 取绝对值(无符号数版本)
|
| template<typename T> |
| constexpr const T & | neforce::sum (const T &x) noexcept |
| | 单参数求和
|
| template<typename First, typename... Rests, enable_if_t<(sizeof...(Rests) > 0), int > = 0> |
| constexpr decltype(auto) | neforce::sum (First first, Rests... args) |
| | 多参数求和
|
| template<typename... Args, enable_if_t<(sizeof...(Args) > 0), int > = 0> |
| constexpr decltype(auto) | neforce::average (Args... args) |
| | 计算平均值
|
| template<typename T> |
| constexpr int | neforce::sign (const T &value) noexcept |
| | 获取数值的符号
|
| template<typename T> |
| constexpr T | neforce::gcd (const T &m, const T &n) noexcept |
| | 计算最大公约数
|
| template<typename T> |
| constexpr T | neforce::lcm (const T &m, const T &n) noexcept |
| | 计算最小公倍数
|
| template<typename T> |
| constexpr enable_if_t< is_floating_point_v< T >, T > | neforce::mod (const T x, const T y) |
| | 浮点数取模运算
|
| template<typename T> |
| constexpr enable_if_t< is_integral_v< T >, T > | neforce::mod (const T x, const T y) |
| | 整数取模运算
|
| template<typename T> |
| constexpr T | neforce::power (const T &x, uint32_t n) noexcept |
| | 幂运算
|
| constexpr decimal_t | neforce::exponential (const uint32_t n) noexcept |
| | 计算e的n次幂
|
| constexpr decimal_t | neforce::logarithm_e (const decimal_t x) noexcept |
| | 计算自然对数
|
| constexpr decimal_t | neforce::logarithm (const decimal_t x, const uint32_t base) |
| | 计算任意底数的对数
|
| constexpr decimal_t | neforce::logarithm_2 (const decimal_t x) |
| | 计算以2为底的对数
|
| constexpr decimal_t | neforce::logarithm_10 (const decimal_t x) |
| | 计算以10为底的对数
|
| constexpr decimal_t | neforce::square_root (const decimal_t x, const decimal_t precise=constants::DEFAULT_TOLERANCE) noexcept |
| | 计算平方根
|
| constexpr decimal_t | neforce::cube_root (const decimal_t x, const decimal_t precise=constants::DEFAULT_TOLERANCE) noexcept |
| | 计算立方根
|
| constexpr uint64_t | neforce::factorial (const uint32_t n) noexcept |
| | 计算阶乘
|
| constexpr decimal_t | neforce::floor (const decimal_t x) noexcept |
| | 向下取整
|
| constexpr decimal_t | neforce::floor (const decimal_t x, const uint32_t bit) noexcept |
| | 向下取整到指定位数
|
| constexpr decimal_t | neforce::ceil (const decimal_t x) noexcept |
| | 向上取整
|
| constexpr decimal_t | neforce::ceil (const decimal_t x, const uint32_t bit) noexcept |
| | 向上取整到指定位数
|
| constexpr decimal_t | neforce::round (const decimal_t x) noexcept |
| | 四舍五入
|
| constexpr decimal_t | neforce::floor_bit (const decimal_t x, const uint32_t bit) noexcept |
| | 向下舍入到指定位数
|
| constexpr decimal_t | neforce::ceil_bit (const decimal_t x, const uint32_t bit) noexcept |
| | 向上舍入到指定位数
|
| constexpr decimal_t | neforce::round_bit (const decimal_t x, const uint32_t bit) noexcept |
| | 四舍五入到指定位数
|
| constexpr decimal_t | neforce::truncate_bit (const decimal_t x, const uint32_t bit) noexcept |
| | 截断到指定位数
|
| constexpr decimal_t | neforce::round (const decimal_t x, const uint32_t bit) noexcept |
| | 四舍五入到指定位数
|
| constexpr decimal_t | neforce::truncate (const decimal_t x, const int bit) noexcept |
| | 截断
|
| constexpr decimal_t | neforce::truncate (const decimal_t x) noexcept |
| | 截断到整数位
|
| constexpr bool | neforce::around_multiple (const decimal_t x, const decimal_t axis, const decimal_t toler=constants::DEFAULT_TOLERANCE) |
| | 判断是否接近某个倍数值
|
| constexpr bool | neforce::around_pi (const decimal_t x, const decimal_t toler=constants::LOOSE_TOLERANCE) |
| | 判断是否接近π的整数倍
|
| constexpr bool | neforce::around_zero (const decimal_t x, const decimal_t toler=constants::LOOSE_TOLERANCE) noexcept |
| | 判断是否接近零
|
| constexpr decimal_t | neforce::remainder (const decimal_t x, const decimal_t y) noexcept |
| | 计算余数
|
| constexpr decimal_t | neforce::float_part (const decimal_t x) noexcept |
| | 获取小数部分
|
| constexpr decimal_t | neforce::float_apart (decimal_t x, int64_t *int_ptr) noexcept |
| | 分离整数和小数部分
|
| constexpr decimal_t | neforce::sine (decimal_t x) noexcept |
| | 计算正弦值
|
| constexpr decimal_t | neforce::cosine (decimal_t x) noexcept |
| | 计算余弦值
|
| constexpr decimal_t | neforce::tangent (decimal_t x) noexcept |
| | 计算正切值
|
| constexpr decimal_t | neforce::cotangent (const decimal_t x) |
| | 计算余切值
|
| constexpr decimal_t | neforce::arctangent (decimal_t x) noexcept |
| | 计算反正切值
|
| constexpr decimal_t | neforce::arcsine (const decimal_t x) noexcept |
| | 计算反正弦值
|
| constexpr decimal_t | neforce::arccosine (const decimal_t x) noexcept |
| | 计算反余弦值
|
|
|
constexpr decimal_t | neforce::constants::EULER = 2.71828182845904523536L |
| | 自然常数 e
|
|
constexpr decimal_t | neforce::constants::PI = 3.14159265358979323846L |
| | 圆周率 π (弧度制)
|
|
constexpr decimal_t | neforce::constants::PHI = 1.61803398874989484820L |
| | 黄金分割比 φ
|
|
constexpr decimal_t | neforce::constants::SEMI_CIRCLE = 180.0L |
| | 半圆角度 180° (角度制)
|
|
constexpr decimal_t | neforce::constants::CIRCLE = 360.0L |
| | 全圆角度 360° (角度制)
|
|
constexpr decimal_t | neforce::constants::TWO_PI_HI = 6.28318530717958647692L |
| | 高精度 2π 高位
|
|
constexpr decimal_t | neforce::constants::TWO_PI_LO = 2.44929359829470641435e-16L |
| | 高精度 2π 低位
|
|
constexpr decimal_t | neforce::constants::MACHINE_EPSILON = numeric_traits<decimal_t>::epsilon() |
| | 机器精度
|
|
constexpr decimal_t | neforce::constants::DEFAULT_TOLERANCE = 1e-12L |
| | 默认容差
|
|
constexpr decimal_t | neforce::constants::LOOSE_TOLERANCE = 1e-9L |
| | 宽松容差
|
| constexpr uint64_t | neforce::constants::FIBONACCI_LIST [] |
| | 预计算的斐波那契数列
|
|
constexpr uint32_t | neforce::constants::FIBONACCI_COUNT = extent_v<decltype(FIBONACCI_LIST)> |
| | 斐波那契数列预计算数量
|
数学函数库
此文件提供了数学函数和常量定义, 包括基本数学运算、三角函数、对数函数、数值计算等常用数学功能。
在文件 math.hpp 中定义.