The syntax for fixed-point decimal constants is shown in Table 1.
Data type | Syntax |
---|---|
fixed-point-decimal-constant | Use the following format:
|
fractional-constant | Use any one of the following formats:
|
digit-sequence | Use any one of the following formats:
|
fixed-point-decimal-suffix | Use any one of the following formats:
|
A fixed-point decimal constant has a numeric part and a suffix that specifies its data type. The components of the numeric part may include a digit sequence representing the integral part, followed by a decimal point (.), followed by a digit sequence representing the fractional part. Either the integral part, the fractional part, or both are present.
Each fixed-point decimal constant has the attributes number of digits (digits) and number of decimal places (precision). Leading or trailing zeros are not discarded when the digits and the precision are determined.
Table 2 gives examples of fixed-point decimal constants and their corresponding attributes:
Fixed-Point Decimal Constant | (digits, precision) |
---|---|
1234567890123456D | ( 16, 0 ) |
12345678.12345678D | ( 16, 8 ) |
12345678.d | ( 8, 0 ) |
.1234567890d | ( 10, 10 ) |
12345.99d | ( 7, 2 ) |
000123.990d | ( 9, 3 ) |
0.00D | ( 3, 2 ) |