7#ifndef MFRAME_EEC25F8B_68C8_45FC_A820_3773DB4D7EF7
8#define MFRAME_EEC25F8B_68C8_45FC_A820_3773DB4D7EF7
15#include "./../lang/NonInstantiable.h"
57 virtual ~Maths(
void)
override =
default;
93 static double acos(
double x);
118 static double atan2(
double y,
double x);
126 static double cos(
double x);
142 static double sin(
double x);
167 static double frexp(
double x,
int *exponent);
176 static double ldexp(
double x,
int exponent);
184 static double log(
double x);
203 static double modf(
double x,
double *integer);
214 static double pow(
double x,
double y);
275 static double fmod(
double x,
double y);
285 static inline int abs(
int a) {
286 if (a < 0)
return ~a;
299 static inline long abs(
long a) {
300 if (a < 0)
return (a * (-1));
313 static inline float abs(
float a) {
314 if (a < 0)
return (a * (-1));
326 if (value & 0x00000003UL)
return (value & 0xFFFFFFF4UL) + 4;
338 if (value & 0x00000007UL)
return (value & 0xFFFFFFF8UL) + 8;
350 static inline int ceil(
int dividend,
int divisor) {
351 return (dividend + (divisor - 1)) / divisor;
361 static inline uint32
ceil(uint32 dividend, uint32 divisor) {
362 return (dividend + (divisor - 1)) / divisor;
372 static inline uint32
min(uint32 a, uint32 b) {
373 return ((a) < (b) ? (a) : (b));
383 static inline int min(
int a,
int b) {
384 return ((a) < (b) ? (a) : (b));
394 static inline uint32
max(uint32 a, uint32 b) {
395 return ((a) > (b) ? (a) : (b));
405 static inline int max(
int a,
int b) {
406 return ((a) > (b) ? (a) : (b));
數學運算工具類別
Definition Maths.h:36
static double pow(double x, double y)
返回 x 的 y 次方
static double asin(double x)
返回x的正弦弧線弧度。
static double ldexp(double x, int exponent)
返回 x 乘以 2 的 exponent 次方。
static float abs(float a)
回傳浮點數的絕對值。如果參數為非負數,則直接回傳該值;若為負數則回傳其相反數。
Definition Maths.h:313
virtual ~Maths(void) override=default
Destroy the Maths object.
static uint32 align32bit(uint32 value)
32位元位址對齊。
Definition Maths.h:325
static double acos(double x)
返回x的反餘弦弧度。
static double atan2(double y, double x)
返回y/x的反正切值(弧度),以判別正確象限。
static double log(double x)
返回x的自然對數(以E為底)。
static long abs(long a)
回傳長整數的絕對值。如果參數為非負數,則直接回傳該值;若為負數則回傳其相反數。
Definition Maths.h:299
static double atan(double x)
返回x的反正切值,以弧度為單位。
static double cos(double x)
返回弧度角x的餘弦值。
static double ceil(double x)
向上取整
static double tanh(double x)
返回x的雙曲正切值。
static double sin(double x)
返回弧度角x的正弦值。
static double fmod(double x, double y)
取餘數
static double sqrt(double x)
計算 x 的平方根
static double sinh(double x)
返回x的雙曲正弦值。
static double log10(double x)
返回x的常用對數(以10為底)。
static double fabs(double x)
計算 x 的絕對值 (雙精度)
static double floor(double x)
向下取整
static int abs(int a)
回傳整數的絕對值。如果參數為非負數,則直接回傳該值;若為負數則回傳其相反數。
Definition Maths.h:285
static uint32 ceil(uint32 dividend, uint32 divisor)
向上取整(無符號整數版本)。
Definition Maths.h:361
static uint32 align64bit(uint32 value)
64位元位址對齊。
Definition Maths.h:337
static int ceil(int dividend, int divisor)
向上取整(整數版本)。
Definition Maths.h:350
static uint32 min(uint32 a, uint32 b)
回傳兩個無符號整數中的較小值。
Definition Maths.h:372
static double modf(double x, double *integer)
分解浮點值 x 為整數與小數部分
static double frexp(double x, int *exponent)
返回x的尾數與指數,滿足 x = 尾數 * 2^指數。
static int max(int a, int b)
回傳兩個整數中的較大值。
Definition Maths.h:405
static float fabsf(float x)
計算 x 的絕對值 (單精度)
static double cosh(double x)
返回x的雙曲餘弦值。
static uint32 max(uint32 a, uint32 b)
回傳兩個無符號整數中的較大值。
Definition Maths.h:394
static int min(int a, int b)
回傳兩個整數中的較小值。
Definition Maths.h:383
Definition NonInstantiable.h:29
Definition Appendable.h:23