CitectVBA Programming Reference > CitectVBA Function Reference > Math/Trigonometry Functions > Sgn

Sgn

Indicates the sign of a number. Sgn does not round the number, and ignores the fractional value of the number.

Sgn expects the argument (Num) to be a valid numeric value. If Num is greater than zero, Sgn returns the value of 1. If Num is equal to zero, Sgn returns the value of 0. If Num is less than zero, Sgn returns the value of -1.

Syntax

Sgn(Num)

Num:

An Integer or expression representing a valid numeric value.

Return Value

Returns a value indicating the Sign (+ or - ) value of the (Num) provided in the argument.

Related Functions

Abs | Fix | Int | Sqrt

Example

Dim vntVal
vntVal = Sgn(99.8) ' returns 1
vntVal = Sgn(-99.8) ' returns -1
vntVal = Sgn(0) ' returns 0