xieite::neg()

Defined in header <xieite/math/neg.hpp>

Checks whether a number is negative. Uses std::signbit() for floating-point types, and always returns false for unsigned types.
Can be used to avoid warnings enabled by -Wtype-limits.


Declaration

template<xieite::is_arith T>
[[nodiscard]] constexpr bool neg(T n) noexcept;


Example

int main() {
	xieite::dump(xieite::neg(5u));
}
Output:
false
[View in Compiler Explorer]