SGN()

SGN(V)

RETURNS THE SIGN OF V

  • Type: Function
  • Parameter: 1
  • Group: Mathematics

ACTION

The function SGN(V) returns the sign of V: 1 if positive, -1 if negative, 0 if zero.

V can be a real or integer number.

SYNTAX: Result=SGN(V)

  • V = real or integer value.

USE

  • The function SGN() is used to know the sign of a number.

ERROR

  • If V is not a correct expression.

EXAMPLE

rem EXAMPLE 1

print sgn(2.1)

print "Result = 1"

rem ---------------

rem EXAMPLE 2

print sgn(-2.1)

print "Result = -1"

rem ---------------

rem EXAMPLE 3

print sgn(0)

print "Result = 0"

SEE ALSO

-