sgn

Determines the sign of a number.

sgn(number) → returns Numeric

Argument Reference for the sgn function

number

Required: Yes

Examples sample code invoking the sgn function


Sign of any number greater than 0

sgn(0.3)

Expected Result: 1


Sign of 0

sgn(0)

Expected Result: 0


Sign of any number less than 0

sgn(-0.3)

Expected Result: -1


Fork me on GitHub