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.

αƒ‘αƒ˜αƒœαƒ’αƒαƒ₯αƒ‘αƒ˜

Sgn (Number)

αƒ“αƒαƒ‘αƒ αƒ£αƒœαƒ”αƒ‘αƒ£αƒšαƒ˜ αƒ›αƒœαƒ˜αƒ¨αƒ•αƒœαƒ”αƒšαƒαƒ‘αƒ:

Integer

Parameters:

Number: Numeric expression that determines the value that is returned by the function.

NumExpression

αƒ“αƒαƒ‘αƒ αƒ£αƒœαƒ”αƒ‘αƒ£αƒšαƒ˜ αƒ›αƒœαƒ˜αƒ¨αƒ•αƒœαƒ”αƒšαƒαƒ‘αƒ:

negative

Sgn returns -1.

0

Sgn returns 0.

positive

Sgn returns 1.


Error codes:

D'oh! You found a bug (text/sbasic/shared/00000003.xhp#err5 not found).

αƒ›αƒαƒ’αƒαƒšαƒ˜αƒ—αƒ˜:

Sub ExampleSgn

    Print ASC("Z") REM αƒαƒ‘αƒ αƒ£αƒœαƒ”αƒ‘αƒ‘ 90

    Print ASC("Z") REM αƒαƒ‘αƒ αƒ£αƒœαƒ”αƒ‘αƒ‘ 90

    Print ASC("Z") REM αƒαƒ‘αƒ αƒ£αƒœαƒ”αƒ‘αƒ‘ 90

End Sub