Arithmetic routines perform mathematical computations. Actual parameters to the arithmetic functions can be of any arithmetic type.
1 – ABS
The ABS function returns a value (of the same data type as the
specified parameter) that is the absolute value of the
parameter.
Syntax:
ABS( x )
The parameter 'x' can be of any arithmetic type.
2 – ARCTAN
The ARCTAN function returns a real value that expresses in
radians the arctangent of the specified parameter.
Syntax:
ARCTAN( x )
The parameter 'x' can be an integer or REAL type.
3 – COS
The COS function returns a real value that represents the cosine
of the specified parameter.
Syntax:
COS( x )
The parameter 'x' can be an integer or REAL type, and is
expressed in radians.
4 – EXP
The EXP function returns a real value that represents the
exponent of the specified parameter (it represents e**x).
Syntax:
EXP( x )
The parameter 'x' can be an integer or REAL type.
5 – LN
The LN function returns a real value that represents the natural
logarithm of the specified parameter.
Syntax:
LN( x )
The parameter 'x' can be an integer or REAL type. The value of
'x' must be greater than zero.
6 – LSHIFT_LSHFT
The LSHIFT and LSHFT predeclared functions return a value of the
same type as its first parameter. The return value represents
the value of the first parameter after the bits have been
shifted to the left.
Syntax:
LSHIFT(expression,expression)
LSHFT(expression,expression)
The parameters are two integer or unsigned values. The first
parameter represents a value to shift. The second parameter
represents the number of bits to shift the first value to the
left. LSHIFT and LSHFT insert zero bits on the right as the
bits shift left.
Note that shifting integers is not equivalent to multiplying or
dividing by a power of two when the value of the integer is
negative.
If the number of bits shifted is larger than the natural integer
size of the target platform, the result is undefined.
7 – MAX
The MAX function returns a value (the same type as that of the
parameters) that is the maximum value of a specified list of
parameters.
Syntax:
MAX( x1,...,xn )
The parameters can be any arithmetic type, but must all be of
the same type.
8 – MIN
The MIN function returns a value (of the same type as that of
the parameters) that is the minimum value of a specified list of
parameters.
Syntax:
MIN( x1,...,xn )
The parameters can be any arithmetic type, but must all be of
the same type.
9 – RSHIFT_RSHFT
The RSHIFT and RSHFT predeclared functions return a value of the
same type as its first parameter. The value represents the
value of the first parameter after the bits have been shifted to
the right.
Syntax:
RSHIFT(expression,expression)
RSHFT(expression,expression)
The parameters are two integer or unsigned values. The first
parameter represents a value to shift; the second represents the
number of bits to shift the first value. The RSHIFT and RSHFT
functions insert zero bits on the left as the bits shift right.
Note that shifting integers is not equivalent to multiplying or
dividing by a power of two when the value of the integer is
negative.
If the number of bits shifted is larger than the natural integer
size of the target platform, the result is undefined.
10 – SIN
The SIN function returns a real value that represents the sine
of the specified parameter.
Syntax:
SIN( x )
The parameter 'x' can be an integer or REAL type, and is
expressed in radians.
11 – SQR
The SQR function returns a value (of the same type of the
parameter) that represents the square of the specified
parameter.
Syntax:
SQR( x )
The parameter 'x' can be of any arithmetic type.
12 – SQRT
The SQRT function returns a real value that represents the
square root of the specified parameter.
Syntax:
SQRT( x )
The parameter 'x' can be of an integer, unsigned, or REAL type.
If the value of 'x' is less than zero, an error occurs.
13 – UAND
The UAND function returns an unsigned value that represents a
binary logical AND operation on each corresponding pair of bits
of the specified parameters.
Syntax:
UAND( u1,u2 )
The parameters 'u1' and 'u2' must be unsigned.
14 – UNOT
The UNOT function returns an unsigned value that represents a
binary logical NOT operation on each bit of the specified
parameter.
Syntax:
UNOT( u1 )
The parameter 'u' must be unsigned.
15 – UOR
The UOR function returns an unsigned value of a binary logical
OR operation on the corresponding pair of bits of two specified
parameters.
Syntax:
UOR( u1,u2 )
The parameters 'u1' and 'u2' must be unsigned.
16 – UXOR
The UXOR function returns an unsigned value of a binary logical
exclusive-OR operation on the corresponding pair of bits of two
specified parameters.
Syntax:
UXOR( u1,u2 )
The parameters 'u1' and 'u2' must be unsigned.
17 – XOR
The XOR function returns a value (of the same type as the
parameters) of a binary logical exclusive-OR operation on two
specified parameters.
Syntax:
XOR( p1,p2 )
The 'p1' and 'p2' parameters must be of the same type and must
be of either the BOOLEAN or SET types.