Description:
Returns an integer indicating the sign of a number.
In the PROMOTIC system it is better to use the Pm.Sign method.
Syntax:
Integer Sgn(Double number)
Parameters:
number | (Double) Any valid numeric expression. |
---|
Return value:
1 - greater than 0
0 - equal to 0
-1 - less than 0
Example:
VBScriptSelect and copy to clipboard
Dim nVar1, nVar2, nVar3, nSign
nVar1 = 12
nVar2 = -2.4
nVar3 = 0
nSign = Sgn(nVar1)
' Returns 1
nSign = Sgn(nVar2)
' Returns -1
nSign = Sgn(nVar3)
' Returns 0