Excellent answer by phuclv. I'd like to add a few things.
In general, C evaluates expressions left to right. If you cast an operand to a double, that will force succeeding portions of the expression to be first promoted to at least double prior to evaluation.
So for instance:
float a,b,c,d;
// In the following, a is first cast to a double, forcing b to be promoted to a double
// This is true for all operations (*/+-%)
c=(double)a * b;
// However, in the following the order of operations can produce surprising results
d=(double)a + b * c;
// There are implied parentheses around the multiplication, so an equivalent expression is
d=(double)a + (b * c);
// b and c are not promoted until after they are combined
// You may need to cast twice to get your desired results
d=(double)a + ((double)b * c);
And to add some details to the definitions of float, double and long double: in all implementations that I know of, float is indeed 32 bits, double is 64 bits, and they are IEEE754 implementations. 'long float' however is not only implementation dependent, but might also be hardware dependent.
Under Visual Studio / MSC, a long double might be either 80 or 64 bits. If the x87 math coprocess is being used then 80 bits is used to store the x87 internal register value. If SSE registers are being used, Microsoft took a shortcut and made 'double' and 'long double' identical for all practical purposes. Note where phuclv says 'sizeof(float) <= sizeof(double)' this is a place where they are the same size and it is completely legal. And to further confuse things, under Windows the x87 is configured in such a way that only 64 bits are used rather than the fill 80 bits available, so while the long double might specify 80 bits, 16 of them will usually be meaningless.
Using the GNU compiler it is possible to specify a 128 bit float, but even there 'long double' does not mean > 64 bits. It is a special variable type (__float128).
float
anddouble
are 2 floating-point types in many languages, typically map tosingle precision
(A.K.A binary32) anddouble precision
(A.K.A binary64) in IEEE-754. No such thing as IEEE754-32 and IEEE754-64 either – Lueluebke