2-245
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Data Type Conversion Instructions
2
**_TO_*** (Bit String-to-Real Number Conversion Group)
The following table shows the valid ranges for In and Out according to their data types.
• To convert a real number to a bit string, use a **_TO_*** (Real Number-to-Bit String Conversion
Group) instruction (page 2-249).
• 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
BYTE
REAL
16#00 to 16#FF 0 to 2.55e+2
LREAL
WORD
REAL
16#0000 to 16#FFFF 0 to 6.5535e+4
LREAL
DWORD
REAL
16#0000_0000 to 16#FFFF_FFFF
0 to 4.294967e+9
LREAL 0 to 4.294967295e+9
LWORD
REAL
16#0000_0000_0000_0000 to
16#FFFF_FFFF_FFFF_FFFF
0 to 1.844674e+19
LREAL 0 to 1.84467440737095e+19
Additional Information
Precautions for Correct Use
Data type
of In
Data type
of Out
Values for which error occurs
DWORD REAL 16#0100_0000 or higher
LWORD LREAL 16#0002_0000_0000_0000 or higher
WORD data
REAL data
In
Out=abc
WORD#16#8000
3.2768e+4