signum

Syntax

signum(X)

Alias: sign

Arguments

x is a scalar/vector/matrix of numeric or Boolean value.

Details

Return 1 if X is positive; 0 if X is 0; -1 if X is negative; NULL if X is NULL.

Examples

signum 1 0 -1 NULL;
// output
[1,0,-1, ]