| Discussion:
|
The SGN function returns the sign (positive, negative or zero) of
a numeric value according to the following chart:
Numeric-argument Value returned
==================================
positive 1
zero 0
negative 1-
The numeric-argument may be a numeric constant, a single-element
numeric variable, a numeric array element, a numeric expression,
or a numeric function.
The intermediate result of the SGN function is stored in a
numeric accumulator with a length and precision of 16.0 If this
intermediate result is moved to a receiving numeric variable, its
precision is automatically adjusted to the defined precision of
that variable.
|
| Example:
|
A = SGN(B)
In the above example, the sign of the value stored in the
variable B is moved to the variable A. For example, if B equals
25, A will equal 1. Likewise, if B equals -25, A will equal -1,
and if B equals 0, A will also equal 0.
|