Functions

signum

Supported By

Syntax

[the] signum of factor

signum ( expression )

Factor and expression yield integers, numbers, or complexes.

Description

If its argument is an integer or a number, the signum function returns -1 if the specified numeric value is negative, 1 if the specified numeric value is positive, 0 if the specified numeric value is zero, and NaN if the specified numeric value is NaN.

If its argument is a complex, the signum function returns a complex with the same complex argument but an absolute value of 1. For example, signum(3,4) returns 0.6,0.8.

Note

For nonzero values of n, signum(n) = n / abs(n).

Synonym

sgn