![](/images/new-backgrounds/1290094/290094215x1.webp)
4 |
Standard Math Functions (ADD, SUB, MUL, DIV)
Math functions include addition, subtraction, multiplication, and division. When a function receives power flow, the appropriate math function is performed on input parameters I1 and I2. These parameters must be the same data type. Output Q is the same data type as I1 and I2.
Note
DIV rounds down; it does not round to the closest integer.
(For example, 24 DIV 5 = 4.)
Math functions operate on these types of data:
Data Type
Description
INT | Signed integer. |
|
|
DINT | Double precision signed integer. |
|
|
REAL | Floating Point |
|
|
Note
The REAL data type is only available on 350 and 360 series CPUs, Release 9 or later, or on all releases of CPU352.
The default data type is signed integer; however, it can be changed after selecting the function. For more information on data types, please refer to chapter 2, section 2, “Program Organization and User References/Data.”
If the operation of INT or DINT results in overflow, the output reference is set to its largest possible value for the data type. For signed numbers, the sign is set to show the direction of the overflow. If the operation does not result in overflow (and the inputs are valid numbers), the ok output is set ON; otherwise, it is set OFF. If signed or double precision integers are used, the sign of the result for DIV and MUL functions depends on the signs of I1 and I2.
|
| _____ | |
|
| ||
(enable) |
|
| (ok) |
|
| ||
| INT | ||
|
| ||
(input parameter I1) | Q— (output parameter Q) | ||
|
| ||
|
| ||
(input parameter I2) | I2 |
_____
Chapter 4 Series |