Yes, if you're not going to include the fractional part. 5
on its own is an integer literal, which is then promoted to double
. 5d
is a double literal. You can also write 5.0
, which can't be an integer literal, and so is a floating-point literal.
From the second link above:
For decimal* floating-point literals, at least one digit (in either the whole number or the fraction part) and either a decimal point, an exponent, or a float** type suffix are required. All other parts are optional. The exponent, if present, is indicated by the ASCII letter e or E followed by an optionally signed integer.
(my emphasis)
Then later
A floating-point literal is of type float
if it is suffixed with an ASCII letter F
or f
; otherwise its type is double
and it can optionally be suffixed with an ASCII letter D
or d
(§4.2.3).
* Here they mean the number base (base 10), not a decimal type.
** Here they meant a floating point suffix, either f
/F
for float
or d
/D
for double