fix(numeric): add disambiguation macro for Math::DivAndRound family functions

This commit is contained in:
Redstone1024 2024-12-04 17:49:01 +08:00
parent 66cfbfa3b3
commit fa29c4a063

View File

@ -399,6 +399,8 @@ NODISCARD FORCEINLINE constexpr T DivAndCeil(T A, T B)
return A >= 0 ? (A + B - 1) / B : A / B;
}
RESOLVE_ARITHMETIC_AMBIGUITY_2_ARGS(CIntegral, DivAndCeil)
/** @return The quotient of the division of the given values and rounds down. */
template <CIntegral T>
NODISCARD FORCEINLINE constexpr T DivAndFloor(T A, T B)
@ -406,6 +408,8 @@ NODISCARD FORCEINLINE constexpr T DivAndFloor(T A, T B)
return A >= 0 ? A / B : (A - B + 1) / B;
}
RESOLVE_ARITHMETIC_AMBIGUITY_2_ARGS(CIntegral, DivAndFloor)
/** @return The quotient of the division of the given values and rounds to nearest. */
template <CIntegral T>
NODISCARD FORCEINLINE constexpr T DivAndRound(T A, T B)
@ -415,6 +419,8 @@ NODISCARD FORCEINLINE constexpr T DivAndRound(T A, T B)
: (A - B / 2 + 1) / B;
}
RESOLVE_ARITHMETIC_AMBIGUITY_2_ARGS(CIntegral, DivAndRound)
/** @return true if the given values are nearly equal, false otherwise. */
template <CArithmetic T>
NODISCARD FORCEINLINE constexpr bool IsNearlyEqual(T A, T B, T Epsilon = TNumericLimits<T>::Epsilon())