Purpose
Returns an integer value indicating the sign of a number.
If the number is |
Sgn returns |
less than 0 |
-1 |
greater than 0 |
1 |
0 |
0 |
Syntax
Sgn (NumericExpression)
NumericExpression |
Any valid numeric expression. |
Example
Sub Main()
Dim dbl As Double
Dim mysign As Integer
dbl = 3.1415
mysign = Sgn (dbl)
If mysign < 0 Then
Print "The value of 'dbl' is negative"
Else
If mysign > 0
Print "The value of 'dbl' is positive"
Else
Print "The value of 'dbl' is zero"
End If
End If
End Sub
|