SIGN Function

Purpose

Returns a 1, -1, or 0, indicating whether the specified value is positive, negative, or zero, respectively.

Syntax

SIGN(x)

Parameters

x is an arithmetic expression.

Description

The SIGN function returns a 1, -1, or 0, indicating whether x is positive, negative, or zero, respectively.

The precision of the result is Fixed Binary(15) unless the -bifprec compiler option overrides it.

Examples

IF SIGN(X) = 1 THEN
   PUT LIST ('SIGN OF X IS POSITIVE');

Restrictions

None.