Chapter 4. Ladder Diagram (LD) Programming
GFK-2950C February 2018 189
4.10 Math Functions
Your program may need to include logic to convert data to a different data type before using a Math
or Numerical function. The description of each function includes information about appropriate data
types. Refer to the Conversion Functions section to understand how to convert one data type to a
different data type.
ABS_DINT, ABS_INT,
ABS_REAL, ABS_LREAL
Finds the absolute value of a double- precision integer (DINT), signed
single-precision integer (INT), or floating-point (REAL or LREAL) value. The
mnemonic specifies the value's data type.
ADD_DINT, ADD_INT,
ADD_REAL,
ADD_LREAL, ADD_UINT
Addition. Adds two numbers.
DIV_DINT, DIV_INT,
DIV_MIXED, DIV_REAL,
DIV_LREAL, DIV_UINT
Division. Divides one number by another and outputs the quotient.
Note: Take care to avoid Overflow conditions when performing
divisions.
MOD_DINT, MOD_INT,
MOD_UINT
Modulo Division. Divides one number by another and outputs the
remainder.
MUL_DINT, MUL_INT,
MUL_MIXED,
MUL_REAL,
MUL_LREAL, MUL_UINT
Multiplication. Multiplies two numbers.
Note: Take care to avoid Overflow conditions when performing
multiplications.
Scales an input parameter and places the result in an output location.
SUB_DINT, SUB_INT,
SUB_REAL, SUB_LREAL,
SUB_UINT
Subtraction. Subtracts one number from another.
To avoid Overflows when multiplying or dividing 16-bit numbers, use the Conversion Functions to convert the numbers to
a 32-bit data type.