A hexadecimal floating constant consists of the following:
C++ extends Standard C++ and C++98 to support hexadecimal floating constants
for compatibility with C99.
The significant part represents a rational number and is composed of the following:
The optional fraction part is a period followed by a sequence of hexadecimal digits.
The exponent part indicates the power of 2 to which the significant part is raised, and is an optionally signed decimal integer. The type suffix is optional. The full syntax is as follows:
>>-+-0x-+-------------------------------------------------------> '-0X-' .------------------. .------------------. V | V | >--+---+--------------+-+--.----+-digit_0_to_f-+-+--| exponent |-+--> | +-digit_0_to_f-+ '-digit_0_to_F-' | | '-digit_0_to_F-' | | .------------------. | | V | | +---+-digit_0_to_f-+-+--.--| exponent |-----------------------+ | '-digit_0_to_F-' | | .------------------. | | V | | '---+-digit_0_to_f-+-+--| exponent |--------------------------' '-digit_0_to_F-' >--+---+------------------------------------------------------->< +-f-+ +-F-+ +-l-+ '-L-' Exponent: .--------------. V | |--+-p-+--+----+----digit_0_to_9-+------------------------------| '-P-' +-+--+ '- --'
You can omit either the whole-number part or the fraction part, but not
both. The binary exponent part is required to avoid the ambiguity of
the type suffix F being mistaken for a hexadecimal
digit.