2 Instruction Descriptions
2-248
NJ-series Instructions Reference Manual (W502)
• To convert an integer to a real number, use an Integer-to-Real Number Conversion Group Instruction.
• To convert data with any data type to an integer, use an Integer Conversion Group Instruction.
• You can use the following instructions to convert a real number to an integer: TRUNC (Truncate),
Round (Round Off Real Number), and RoundUp (Round Up Real Number). All of these instructions
have a REAL input and DINT output, or a LREAL input and LINT output. The differences between
these instructions are shown in the following table.
• Always use the correct instruction name for the data types of In and Out.
• If the conversion result exceeds the valid range of Out, Out will contain an illegal value.
Additional Information
Input value
Output value
REAL_TO_INT TRUNC Round RoundUp
REAL#1.6 INT#2 DINT#1 DINT#2 DINT#2
REAL#1.5 INT#2 DINT#1 DINT#2 DINT#2
REAL#1.5 INT#1 DINT#1 DINT#1 DINT#2
REAL#2.5 INT#2 DINT#2 DINT#2 DINT#3
REAL#-1.6 INT#-2 DINT#-1 DINT#-2 DINT#-2
REAL#-1.5 INT#-2 DINT#-1 DINT#-2 DINT#-2
REAL#-1.4 INT#-1 DINT#-1 DINT#-1 DINT#-2
REAL#-2.5 INT#-2 DINT#-2 DINT#-2 DINT#-3
Precautions for Correct Use