A float
is a type that holds a 32-bit floating point number, while the constant 4.4e10
represents a double
, which holds a 64-bit floating point number (i.e. a double-precision floating point number)
When you assign 4.4e10
to c
, the value 4.4e10
cannot be represented precisely (a rounding error in a parameter called the mantissa), and the closest possible value (44000002048) is stored. When it is passed to printf
, it is promoted back to double
, including the rounding error.
In the second case, the value is a double
the whole time, without narrowing and widening, and it happens to be the case that a double
can represent the value exactly.
If this is undesirable behavior, you can declare c
as a double
for a bit more precision (but beware that you'll still hit precision limits eventually).