Skip to end of banner
Go to start of banner

sign

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Availability

This routine is available starting with katl-commons 2.5.

Syntax

sign(number)


Description


Determines the sign of a number (signum). Returns 1 if the number is positive, zero (0) if the number is 0, and -1 if the number is negative.



Parameters

ParameterTypeRequiredDescription
numberNumberYesAny real number.

Return type

number


Example

number a = sign(3);
print("a= " + a);
number b = sign(-4);
print("b= " + b);
number c = sign(3-3);
print("b= " + c);

Prints:

        a= 1;

        b= -1;

        c= 0;

See also


  • No labels