Sgn Function

αžαŸ’αžšαž‘αž”αŸ‹β€‹αž…αŸ†αž“αž½αž“β€‹αž‚αžαŸ‹β€‹αž…αž“αŸ’αž›αŸ„αŸ‡ -1 αž“αžΉαž„ 1 αžŠαŸ‚αž›β€‹αž…αž„αŸ’αž’αž»αž›β€‹αž”αŸ’αžšαžΆαž”αŸ‹β€‹αž”αŸ’αžšαžŸαž·αž“β€‹αž”αžΎβ€‹αž…αŸ†αž“αž½αž“β€‹αžŠαŸ‚αž›β€‹αžαŸ’αžšαžΌαžœβ€‹αž”αžΆαž“β€‹αž αž»αž…β€‹αž‘αŸ…β€‹αž’αž“αž»αž‚αž˜αž“αŸ αž‡αžΆβ€‹αž…αŸ†αž“αž½αž“β€‹αžœαž·αž‡αŸ’αž‡αž˜αžΆαž“ αž’αžœαž·αž‡αŸ’αž‡αž˜αžΆαž“ αž¬β€‹αžŸαžΌαž“αŸ’αž™Β αŸ”

αžœαžΆαž€αŸ’αž™β€‹αžŸαž˜αŸ’αž–αž“αŸ’αž’ αŸ–


Sgn (Number)

αžαž˜αŸ’αž›αŸƒβ€‹αžαŸ’αžšαž‘αž”αŸ‹ αŸ–

Integer

αž”αŸ‰αžΆαžšαŸ‰αžΆαž˜αŸ‰αŸ‚αžαŸ’αžš αŸ–

αž…αŸ†αž“αž½αž“β€‹ αŸ– αž€αž“αŸ’αžŸαŸ„αž˜β€‹αž›αŸαžβ€‹αžŠαŸ‚αž›β€‹αž€αŸ†αžŽαžαŸ‹β€‹αžαž˜αŸ’αž›αŸƒβ€‹ αžŠαŸ‚αž›β€‹αžαŸ’αžšαžΌαžœβ€‹αž”αžΆαž“β€‹αžαŸ’αžšαž‘αž”αŸ‹β€‹αžŠαŸ„αž™β€‹αž’αž“αž»αž‚αž˜αž“αŸΒ αŸ”

Number

αžαž˜αŸ’αž›αŸƒβ€‹αžαŸ’αžšαž‘αž”αŸ‹

αž’αžœαž·αž‡αŸ’αž‡αž˜αžΆαž“

Sgn returns -1.

0

Sgn returns 0.

αžœαž·αž‡αŸ’αž‡αž˜αžΆαž“

Sgn returns 1.


Error codes:

5 αž€αžΆαžšβ€‹αž αŸ…β€‹αž”αŸ‚αž”αž”αž‘β€‹αž˜αž·αž“β€‹αžαŸ’αžšαžΉαž˜αžαŸ’αžšαžΌαžœ

αž§αž‘αžΆαž αžšαžŽαŸ αŸ–


Sub ExampleSgn
    Print sgn(-10) REM returns -1
    Print sgn(0) REM returns 0
    Print sgn(10)  REM returns 1
End Sub

Please support us!