Files
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

23 lines
869 B
C++

#pragma once
class COMPARE_DOUBLE
{
public :
static bool up_zero(const double &v, const double &tol = .01) { return v > tol; }
static bool upequal_zero(const double &v, const double &tol = .01) { return v >= -tol; }
static bool down_zero(const double &v, const double &tol = .01) { return v < -tol; }
static bool downequal_zero(const double &v, const double &tol = .01) { return v <= tol; }
static bool equal_zero(const double &v, const double &tol = .01) { return v >= -tol && v <= tol; }
static bool equal(const double &a, const double &b, const double &tol = .01) { return equal_zero(a - b, tol); }
static bool downequal(const double &a, const double &b, const double &tol = .01) { return downequal_zero(a - b, tol); }
static bool upequal(const double &a, const double &b, const double &tol = .01) { return upequal_zero(a - b, tol); }
};