![]() ![]() |
||||
|
||||
There are two kinds of numeric literals, real and integer.
A real_literal is a numeric_literal that
includes a point; an integer_literal is a numeric_literal without a point.
Syntax
|
||||
A decimal literal is a numeric_literal in the conventional
decimal notation (that is, the base is ten).
Syntax
Semantics
An underline character in a numeral does not affect its
meaning. The letter E of an exponent can
be written either in lower case or in upper case, with the same meaning.
An exponent indicates the power of ten by which the value
of the decimal literal without the
exponent is to be multiplied to obtain the value of the decimal literal with the exponent.
Examples
12 0 1E6 123_456--
integer literals
12.0 0.0 0.456 3.14159_26 --
real literals |
||||
A based literal is a numeric_literal expressed in a form
that specifies the base explicitly.
Syntax
Legality Rules
The base (the numeric value of the decimal numeral preceding
the first #) shall be at least two and
at most sixteen. The extended_digits A through F represent the digits ten through fifteen
respectively. The value of each extended_digit of a based_literal shall be less than the base.
Semantics
The conventional meaning of based notation is assumed.
An exponent indicates the power of the
base by which the value of the based literal without the exponent is to be multiplied to obtain the
value of the based literal with the exponent. The base and the exponent, if any, are in decimal
notation.
The extended_digits A through F can be written either
in lower case or in upper case, with the
same meaning.
Examples
2#1111_1111#16#FF# 016#0ff# --
integer literals of value 255
2#1110_0000#16#E#E18#240# --
integer literals of value 224 |
||||