In mathematics, the sign function or signum function is a function that has the value −1, +1 or 0 according to whether the sign of a given real number is positive or negative, or the given number is itself zero. In mathematical notation the sign function is often represented as sgn x {\displaystyle \operatorname {sgn} x} or sgn ( x ) {\displaystyle \operatorname {sgn}(x)} .