MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ sign_nonzero()

template<typename T >
constexpr T MayaFlux::Kinesis::sign_nonzero ( x)
constexprnoexcept

Sign of x, returning -1 or +1, never 0.

std::copysign(1, x) but readable. Useful when zero must be treated as positive (e.g. initial state of a direction accumulator).

Definition at line 259 of file Scalar.hpp.

260{
261 return x < T { 0 } ? T { -1 } : T { 1 };
262}