The function SIGN outputs 1 when given a positive number, -1 when given a negative number, and 0 when given 0.
This function takes a single Number as input. It returns another Number: 1 if the given number is positive number, -1 if it's negative, and 0 if it's 0.
Declaration
SIGN(number) -> sign
Parameters
number (required, type: Number
)
The number to check the sign of.
Return Values
sign (type: Number
)
This indicates if the given number is positive, negative, or zero.
1 means the given number is positive, -1 means it's negative, and 0 means it's 0.
Examples
The following example returns 1 because 44.5 is positive:
SIGN(44.5) -> 1
The following example returns -1 because -5 is negative:
SIGN(-5) -> -1
The following example demonstrates what SIGN returns when given the number 0, which is neither positive or negative:
SIGN(0) -> 0