25.5
Notation of Constants
This section describes the notation of constants.
Type
Boolean value
Integral
Binary
Octal
Decimal
Hexadecimal
Real number
Decimal
notation
Exponential
notation
String
String
String
[Unicode]
Time
In the notation of binary, octal, decimal, hexadecimal, and real numbers, the numbers can be separated using
an underscore (_) to make programs easy to see. For example, the double word [unsigned] in the notation of
binary is as follows.
2#1100_1100_1100_1100
The separations by underscores (_) are ignored in program processing.
Notation
Set "FALSE" or "TRUE".
Add "K" or "H" before "0" or "1".
Add "2#" before a binary number.
Add "8#" before an octal number.
Directly enter a signed or unsigned decimal number.
Add "K" before a signed or unsigned decimal
number.
Add "16#" before a hexadecimal number.
Add "H" before a hexadecimal number.
Directly enter a signed or unsigned real decimal
number with a decimal point.
Add "E" before a signed or unsigned real decimal
number with a decimal point.
Add "E" and a signed or unsigned exponent
(decimal) at the end of the real number.
Add a signed exponent (decimal) at the end of the
real number with "E".
Enclose a string in single quotation marks (' ').
Enclose a string in double quotation marks (" ").
Add "T#" or "TIME#" at the beginning. (Page
404 Notation of time)
Example
Applicable data type
TRUE, FALSE
Bit
K0, K1, H0, H1
2#0010, 2#01101010,
• Word [unsigned]/bit string [16 bits]
2#1111_1111
• Double word [unsigned]/bit string [32
bits]
8#0, 8#337, 8#1_1
• Word [signed]
123, +123, -123, 12_3
• Double word [signed]
K123, K-123
16#FF, 16#1_1
HFF, HEAD
2.34, +2.34, -2.34,
• Single-precision real number
3.14_15
• Double-precision real number
E2.34, E-2.34
1.0E6, 1.0E-6
E1.001+5, E1.001-6
'ABC'
String
"ABC"
String [Unicode]
T#1h,
Time
T#1d2h3m4s5ms,
TIME#1h
25.5 Notation of Constants
25
25 CONSTANTS
403