Please enable JavaScript to view this site.

 

int = Sign(nNumber)

 

This macro function takes an integer as parameter and returns 1 if the number is positive, -1 if the number is negative, and 0 if the number is zero.

Sign(20)  // 1
Sign(-30// -1
Sign(0)   // 0

Note that the following is always true :

nNumber ≡ Sign(nNumber) * Abs(nNumber)

See also: Abs.

 

 


Topic 174330, last updated on 18-Apr-2020