2 Instruction Descriptions
2-238
NJ-series Instructions Reference Manual (W502)
The following table shows the valid ranges for In and Out according to their data types.
• To convert a real number to an integer, use a **_TO_*** (Real Number-to-Integer Conversion Group)
instruction (page 2-246).
• To convert data with any data type to a real number, use a TO_** (Real Number Conversion Group)
instruction (page 2-281).
• Always use the correct instruction name for the data types of In and Out.
• Depending on the data types of In and Out, rounding will be performed for the effective digits of the
real number. This will cause error between the values before and after conversion. The following table
lists the data types that result in error.
Data type
of In
Data type
of Out
Valid range for In Valid range for Out
USINT
REAL
0 to 255 0 to 2.55e+2
LREAL
UINT
REAL
0 to 65535 0 to 6.5535e+4
LREAL
UDINT
REAL
0 to 4294967295
0 to 4.294967e+9
LREAL 0 to 4.294967295e+9
ULINT
REAL
0 to 18446744073709551615
0 to 1.844674e+19
LREAL 0 to 1.84467440737095e+19
SINT
REAL
−128 to 127 −1.28e+2 to 1.27e+2
LREAL
INT
REAL
−32768 to 32767 −3.2768e+4 to 3.2767e+4
LREAL
DINT
REAL
−2147483648 to 2147483647
−2.147483e+9 to 2.147483e+9
LREAL −2.147483648e+9 to 2.147483647e+9
LINT
REAL
−9223372036854775808 to
9223372036854775807
−9.223372e+18 to 9.223372e+18
LREAL
−9.22337203685477e+18 to
9.22337203685477e+18
Additional Information
Precautions for Correct Use
Data type
of In
Data type
of Out
Values for which error occurs
DINT
REAL −16777216 or lower, or 16777216 or higher
LINT
UDINT
REAL 16777216 or higher
ULINT
LINT LREAL
−9007199254740992 or lower, or 9007199254740992 or
higher
ULINT LREAL 9007199254740992 or higher
INT data
REAL data
In
Out=abc
INT#1234
1.234e+3