Fixed-point decimal literals
Fixed-point decimal constants are a z/OS® XL C extension to Standard C. This type is available when you specify the LANGLVL(EXTENDED) compile-time option.
A fixed-point decimal constant has a numeric part and a suffix that specifies its type. The numeric part can include a digit sequence that represents the whole-number part, followed by a decimal point (.), followed by a digit sequence that represents the fraction part. Either the integral part or the fractional part, or both must be present.
A fixed-point constant has the form:
.--------------. V | >>-+- . ----digit_0_to_9-+-------------------+--+-D-+---------->< | .--------------. .--------------. | '-d-' | V | V | | +---digit_0_to_9-+-- . ----digit_0_to_9-+-+ | .--------------. | | V | | +---digit_0_to_9-+-- . -------------------+ | .--------------. | | V | | '---digit_0_to_9-+------------------------'
A fixed-point constant has two attributes:
- Number of digits (size)
- Number of decimal places (precision).
The suffix D or d indicates a fixed-point constant.
The following are examples of fixed-point
decimal constants:
Fixed-point constant | (size, 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) |
For more information on fixed-point decimal data types, see z/OS XL C/C++ Programming Guide.