Returns an integer that indicates if a specified number is positive, negative, or zero (0).

Syntax

SIGN(<expN>)

<expN>

The number whose sign (positive, negative, or zero) to determine.

Description

Use SIGN( ) to reduce an arbitrary numeric value into one three numbers: 1, -1, or zero. SIGN( ) returns 1 if a specified number is positive, -1 if that number is negative, and 0 if that number is 0.

SIGN( ) is used when the numbers 1, -1, and/or 0 are appropriate for an action, based on the sign—but not the magnitude—of another number. When interested in the sign alone, it’s more straightforward to compare the number with zero using a comparison operator.

SIGN( ) always returns an integer, regardless of the value of SET DECIMALS.