Sgn Function

Returns an integer number between -1 and 1 that indicates if the number that is passed to the function is positive, negative, or zero.

Sintakse:


Sgn (Skaitlis)

Atgrieztā vērtība:

Integer

Parametri:

Skaitlis: skaitliska izteiksme, kura nosaka funkcijas atgriezto vērtību.

Number

Atgrieztā vērtība

negatīvs

Sgn atgriež -1.

0

Sgn atgriež 0.

pozitīvs

Sgn atgriež 1.


Error codes:

5 Nederīgs procedūras izsaukums

Piemērs:


Sub ExampleSgn
    Print sgn(-10) ' atgriež -1
    Print sgn(0) ' atgriež 0
    Print sgn(10) ' atgriež 1
End Sub

Please support us!