sign/2—determine whether a numeric value is positive, negative, or  zero


The sign/2 function determines whether a numeric value is positive, negative, or  zero.

$SIGN=sign($NUMBER)

sign/2 arguments

Argument

Mode

Type

Description

$NUMBER

Input

INTEGER|REAL

Specifies the numeric (integer or real) value for which the sign is to be returned

$SIGN

Output

INTEGER

Returns the sign of the number. Possible values include:

  • -1—Negative number
  • 0—Zero value
  • 1—Positive number

The sign/2 function returns the sign of the numeric value specified by the $NUMBER argument and returned as $SIGN.

Note

A real number that is not precisely 0 can still be displayed as 0.0 due to rounding errors or limited precision. The sign of such a real number will not be 0.

sign/2 example

$SIGN = sign( $AVERAGE_DURATION - real($E.duration) );

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*