Table of Contents

sgn

int sgn(num x)

num - any numeric type (int or fixed)

Description

Returns the sign of x as an integer.

Examples

sgn(    7) -> 1
sgn(   -7) -> -1
sgn( 12.3) -> 1
sgn(-12.3) -> -1
sgn(    0) -> 0