From 02655fa8faabeff56167a2545e9ad973cd27853a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=88=98?= <40414978+PatriceJiang@users.noreply.github.com> Date: Wed, 20 Jul 2022 08:59:56 +0800 Subject: [PATCH] use cmath std::fabs instead of cstdlib std::abs (#12075) --- native/cocos/math/Math.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/native/cocos/math/Math.h b/native/cocos/math/Math.h index 0e2c78848c..1b73eeebe8 100644 --- a/native/cocos/math/Math.h +++ b/native/cocos/math/Math.h @@ -24,8 +24,8 @@ ****************************************************************************/ #pragma once +#include #include -#include #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