21 DEVICES
21.10 Constant
221
21
21.10 Constant
This section explains constants.
Decimal constant (K)
Device that specifies decimal data for the program. Specified by K. (Example: K1234)
The specification range is determined by type of argument data of instruction using a decimal constant.
Hexadecimal constant (H)
Device that specifies hexadecimal data for the program. Specified by H. (Example: H1234)
When specifying BCD data, specify each digit of hexadecimal number in 0 to 9. The specification range is determined by type
of argument data of instruction using a hexadecimal constant. If data size is 16 bits, H0 to HFFFF; if 32 bits, H0 to
HFFFFFFFF.
Real constant (E)
Device that specifies real numbers for the program. Specified by E. (Example: E1.234)
Setting range of real numbers
The setting range of real numbers is explained below.
-2
128
Device-2
-126
, 0, 2
-126
Device2
128
(E-3.40282347+38 to E-1.17549435-38, 0, E1.17549435-38 to E3.40282347+38)
Operation during calculation
■Operation at overflow and underflow
Operation is as follows if overflow or underflow occurs during calculation.
• Overflow: Error occurs.
• Underflow: Becomes "0" without error occurring.
■Operation when special value
*1
is input
If calculation is performed when input data is a special value, an error occurs. If "-0" occurs during calculation, it is treated as
"+0"; the calculation result does not become "-0".
*1 Special values are -0, denormalized numbers, non-numbers, .
Programming expressions
Real numbers can be specified by the following expressions.
• Normal expression: Specify a numeric value as it is. (Example: E10.2345 in the case of 10.2345)
• Scientific notation: Specify a numeric value in the format "numeric value" 10n. (Example: E1.234+3 in the case of 1234.
"+3" represents "10
3
".)
Character string constant
Device that specifies character string. Shift JIS code character strings can be used. Character strings end with NULL
character (00H). Specify by "character string".
Argument data type of instruction Specification range of decimal constants
Data size Data type name
16 bits Word (signed) K-32768 to K32767
Word (unsigned)/Bit string (16-bit) K0 to K65535
32 bits Double word (signed) K-2147483648 to K2147483647
Double word (unsigned)/Bit string (32-bit) K0 to K4294967295