Floating point literals
suggest changeFloating point literals are used to represent signed real numbers. The following suffixes can be used to specify type of a literal:
Suffix | Type | Examples |
—— | —— | —–– |
none | double
| 3.1415926
-3E6
f
, F
| float
| 3.1415926f
2.1E-6F
l
, L
| long double
| 3.1415926L
1E126L
In order to use these suffixes, the literal must be a floating point literal. For example, 3f
is an error, since 3
is an integer literal, while 3.f
or 3.0f
are correct. For long double
, the recommendation is to always use capital L
for the sake of readability.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents