2.3.6. - Numeric Constants
Numeric constants can be integers or floating point numbers. Integer constants are considered octal if the first digit is
0
. Valid digits in the rest of the constant are
0
through
7
. A hexadecimal
constant begins with
0x
or
0X
and is followed by
digits or the letters
a
or
A
through
f
or
F
, which have values 10 through 15.
Otherwise, a sequence of digits is a decimal
constant.
Floating-point constants have an integer part, a decimal point, a fraction part, an
e
or
E
and an optionally signed exponent.
The integer part or the fraction part,
but not both, may be missing.
The decimal point or the
e
and exponent, but not both, may be missing.
As spec stores number values internally in double-precision format, the range of integer and floating constants is determined by the range of double-precision numbers. With the usual 64 bits allocated for a double number, the significand uses 52 bits and the sign and exponent use 12 bits. Although signed integers can have values from ±263or unsigned values from 0 to 264, the values will only have 52 significant bits.
The following are valid numeric constants.
65535 0177777 0xFFFF +1066 1.066e3 1.066e+3