C Language Floating point literals


Example

Floating point literals are used to represent signed real numbers. The following suffixes can be used to specify type of a literal:

SuffixTypeExamples
nonedouble3.1415926 -3E6
f, Ffloat3.1415926f 2.1E-6F
l, Llong double3.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.