You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Include/iAlg/iAlgMath/zxMathBase.h

55 lines
1.1 KiB
C

#pragma once
#include "Defines.h"
#include "iAlgMath_global.h"
// 数学基础类
class I_ALGMATH_EXPORT zxMathBase
{
public:
zxMathBase();
virtual ~zxMathBase();
public:
/// @brief 求i的阶乘
static int factorial(int i);
/// @brief 数据是否有效
static bool isValidValue(float f);
template<typename T> static bool isValidValue(T v)
{
T tTemp = v;
if (tTemp >= 0.0)
{
return true;
}
if (qAbs(tTemp - SYS_VALUE_INVALID) > SYS_VALUE_ZERO_PLUS && \
qAbs(tTemp - SYS_VALUE_INVALID1) > SYS_VALUE_ZERO_PLUS && \
qAbs(tTemp - SYS_VALUE_INVALID2) > SYS_VALUE_ZERO_PLUS)
{
return true;
}
return false;
}
/// @brief 判断数据是否有限,非无穷大或无穷小
static bool isLimitedValue(float f);
template<typename T> static bool isLimitedValue(T v)
{
T tTemp = v;
if (tTemp == tTemp && \
tTemp + 10.0 != tTemp)
{
return true;
}
return false;
}
/// 查找幂
static double findDevision(double dValue);
};