<< Prev        Next >>

ID : 242

Sgn

Function

To investigate the numeric value sign (positive/negative) and return the result.

Syntax

Sgn(formula)

Guaranteed entry

Formula
Specify numeric value data to investigate the sign (positive/negative).

Return value

Return the sign investigation result by integer type data. Return 0 if it is positive, 0 if 0 or -1 if negative.

Description

Sign of formula is investigated and the following numeric value is returned.

Argument Return value
Positive 1
0 0
Negative -1

Related Terms

Abs

Attention

-

Example

'!TITLE "Investigation of Sign"
' Investigate the aaa value sign
Sub Sample_Sgn

  Dim aaa As Single
  Dim bbb As Single

  aaa = -5

  ' Return a sign of variable aaa
  bbb = Sgn( aaa )

  ' Display "-1" on the message output window
  PrintDbg bbb

End Sub

ID : 242

<< Prev        Next >>