/* --------------------------------------------------------------------- // Figure 7.18: Converting a float to a double. // --------------------------------------------------------------------- */ #include void main() { float f = 0.1; /* Precision limited to about 7 decimal places. */ double d = 0.1; /* Precision limited to about 15 decimal places. */ double x = f; /* Converted float; same precision as original value. */ printf( "0.1 as a float = %.17f\n", f ); printf( "0.1 as a double = %.17f\n", d ); printf( "0.1 converted from float to double = %.17f\n", x ); }