mirror of
https://github.com/BlackMATov/vmath.hpp.git
synced 2026-01-05 01:51:06 +07:00
fix approx<unsigned> with epsilon
This commit is contained in:
@@ -396,7 +396,11 @@ namespace vmath_hpp
|
||||
template < typename T >
|
||||
[[nodiscard]] std::enable_if_t<std::is_arithmetic_v<T>, bool>
|
||||
constexpr approx(T x, T y, T epsilon) noexcept {
|
||||
return abs(x - y) <= epsilon;
|
||||
if constexpr ( std::is_unsigned_v<T> ) {
|
||||
return (x < y ? (y - x) : (x - y)) <= epsilon;
|
||||
} else {
|
||||
return abs(x - y) <= epsilon;
|
||||
}
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
|
||||
Reference in New Issue
Block a user