Skip to main content

Sgn()

This function will return an indicator of the sign.  If the number is negative it returns -1, if positive it returns 1 and if it is 0 it returns 0.  The return value is an integer type.

Script

Sub Main
    Dim MyNumber As Double
    MyNumber = 55.55
    MsgBox Sgn(MyNumber) ' returns 1
End Sub

Sub Main
    Dim MyNumber As Double
    MyNumber = -55.55
    MsgBox Sgn(MyNumber) ' returns -1
End Sub

IDEAScript Language