Hi Pradeep ,
float and double both are to contain floating point numbers .
But width size of float is of 32-bit whereas double is of 64-bit .
When you cast a float to double , You are trying to put smaller stuff
into bigger container . Hence you are safe and there is no potential risk
of loosing precision .
But When you cast a double to float , You are trying to put bigger stuff
into smaller container . Hence there is potential risk of loosing precision . And compiler is smart enough to detect it , that is why it warns you by issuing error .
If you still want to do this , You have to cast it explicitly .