Without any suffixes all floating-point literals are double
in C++. If an f
suffix is attached then the literal is a float
and if written with L
suffix then it'll be a long double
. Literal constants generally don't depend on their magnitude. Integer literals like 1 or 2 are of type int
although their values lies completely in char's range
The type of a floating literal is
double
unless explicitly specified by a suffix. The suffixesf
andF
specifyfloat
, the suffixesl
andL
specifylong double