
Operating Functions
Chapter 5
5–45
We divide the unary operators into three groups; general purpose, log
functions and trig functions.
5.5.2.1
General Purpose Operators
Following are the general purpose operators.
5.5.2.1.1 ABS([expr])
Returns the absolute value of the expression.
Examples:
uPRINT ABS(5) uPRINT ABS(–5)
55
5.5.2.1.2 NOT([expr])
Returns a 16 bit one’s complement of the expression. The expression must
be a valid integer (i.e. between 0 and 65535 (0FFFFH) inclusive).
Non-integers are truncated, not rounded.
Examples:
uPRINT NOT(65000) uPRINT NOT(0)
535 65535
5.5.2.1.3 INT([expr])
Returns the integer portion of the expression.
Examples:
uPRINT INT(3.7) uPRINT INT(100.876)
3 100
5.5.2.1.4 SGN([expr])
Returns a value of +1 if the argument is greater than zero, zero if the
argument is equal to zero and –1 if the argument is less than zero.
Examples:
uPRINT SGN(52) uPRINT SGN(0) uPRINT SGN(–8)
10 –1
5.5.2.1.5 SQR([expr])
Returns the square root of the argument. The argument may not be less
than zero. The result returned is accurate to within +/–a value of 5 on the
least significant digit.
Examples:
uPRINT SQR(9) uPRINT SQR(45) uPRINT SQR(100)
3 6.7082035 10
5.5.2
Unary Operators
Comentarios a estos manuales