mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
use cmath std::fabs instead of cstdlib std::abs (#12075)
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include "base/Macros.h"
|
||||
|
||||
namespace cc {
|
||||
@@ -65,15 +65,15 @@ inline bool isPowerOfTwo(T n) {
|
||||
}
|
||||
|
||||
inline bool isEqualF(float lhs, float rhs, float precision = 0.000001F) {
|
||||
return (std::abs(lhs - rhs) < precision);
|
||||
return (std::fabs(lhs - rhs) < precision);
|
||||
}
|
||||
|
||||
inline bool isNotEqualF(float lhs, float rhs, float precision = 0.000001F) {
|
||||
return (std::abs(lhs - rhs) > precision);
|
||||
return (std::fabs(lhs - rhs) > precision);
|
||||
}
|
||||
|
||||
inline bool isNotZeroF(float v, float precision = 0.000001F) {
|
||||
return (std::abs(v) > precision);
|
||||
return (std::fabs(v) > precision);
|
||||
}
|
||||
|
||||
} // namespace math
|
||||
|
||||
Reference in New Issue
Block a user