When the number word starts with a radix indicator then after the radix indicator an integer number in the corresponding radix is expected. There is the binary radix indicator (“0b”), the octal radix indicator (“0o”) and the hex radix indicator (“0x”). Currently only integers can be provided with a non-decimal radix. Floats and decimals do not currently have this feature.

number --> integer | float | decimal.

reference --> "0r" hex_digit { hex_digit }.

integer --> "0b" bin_digit { bin_digit | "_" }

| "0o" oct_digit { oct_digit | "_" }

| "0x" hex_digit { hex_digit | "_" }

| "0'" ( "''" | "\\" escape | " " | str_char )

| mantissa.

float --> mantissa fraction [ exponent ]

| "0f" [ mantissa ] [ fraction ] [ exponent ].

decimal --> "0d" [ mantissa ] [ fraction ] [ exponent ].

mantissa --> digit { digit | "_" }.

fraction --> "." digit { digit | "_" }.

exponent --> ( "e" | "E" ) [ "-" | "+" ] digit { digit | "_" }.

bin_digit --> "0" ... "1".

When the number word starts with a reference indicator (“0r”) then it is considered a reference. References can only be written to an output stream, but they cannot be read in from an input stream. If an attempt is made to read a reference from an input stream then a syntax error is thrown.

When the number word starts with a small float indicator (“0f”) then it is converted into a small float constant. The conversion might fail when the number word does not conform to the small float syntax or when the number is outside of the representation range.

Examples:2009 % is a number and also an integer

0xFF % is a number and also an integer.

0’a % is a number and also an integer.

3.1415 % is a number and also a float.

0d199.98 % is a number and also a decimal.

0rA276B3 % is a reference.

1e-12 % is not a number, float fraction missing.

When the number word starts with a decimal indicator (“0d”) then
it is converted into a decimal constant. The conversion might fail
when the number word does not conform to the decimal syntax or
when the number is outside the representation range. The optional
fraction and optional exponent influences the scale of the decimal
number.

When the number word contains the period (“.”) then it is
converted into a float constant, oth-erwise it is converted into
an integer constant. The conversion might fail when the number
word does not conform to the integer or float syntax or when the
number is outside of the representation range.

2_000_000 % is a number and also an integer

0xFFFF_FFFF % is a number and also an integer.

3.14159_26535_89793 % is a number and also a float.

0b1__0 % is not a number, two underscores in a row.

It is also allowed that the mantissa, the fraction or the exponent contain one or many underscores. This also holds if there is a radix, small float or decimal indicator. The syntax does not express the following additional constraints. It is not allowed that a number contains two underscores in a row. It is not allowed that a number contains an underscore at the end of the mantissa, the fraction or the exponent.

When the number word starts with a character indicator (“0’”) then it is decoded as a character constant. The value of a character constant is the integer character code of the character that immediately follows the character indicator. Character escaping as found in strings is also allowed after the character indicator.