13
SINGLE VARIABLE FUNCTIONS
13.1
Calculating the Absolute Value
ABS
This function outputs the absolute value of an input value.
Structured text
d:=ABS(s);
Setting data
■Description, type, data type
Argument
s (IN)
d
Processing details
■Operation processing
• This function outputs the absolute value of the INT, DINT, REAL, or LREAL data type value input to (s), in the same type of
data as (s), from (d).
• When the input value is defined as A and the output value is defined as B, the relationship of A and B will be as follows:
B = |A|
• Input an INT, DINT, REAL, or LREAL data type value to (s).
• If -32768 in INT data type is input to (s), (d) will output -32768.
• If -2147483648 in DINT data type is input to (s), (d) will output -2147483648. (No operation error occurs.)
■Operation result
The operation processing is performed. The operation result is output from (d).
Operation error
• When (s) is of REAL data type
Error code
Description
3402H
The value output from (d) is -0, a subnormal number, NaN (not a number), or ±∞.
• When (s) is of LREAL data type
Error code
Description
3402H
The value output from (d) is -0, a subnormal number, NaN (not a number), or ±∞.
13 SINGLE VARIABLE FUNCTIONS
166
13.1 Calculating the Absolute Value
Description
Input
Output
Type
Data type
Input variable
ANY_NUM
Output variable
ANY_NUM