Template Function sgn

Function Documentation

template<typename T>
inline int sgn(T val)

Return the sign of the given value (-1, 0 or +1).

Template Parameters:

T – Type of the number.

Parameters:

val – The value to get sign of.

Returns:

Sign of the value: -1 for negative, 0 for 0, +1 for positive numbers.