Hi Rohan,
Converting a long to a float is a widening conversion.
Although this is well known fact that
1- long takes 64 bits
2- float takes 32 bits
A number long can hold, float can easily hold but vice versa is not true.
That is why if you assign a long value to the float, it is widening conversion but for vice versa you do narrowing conversion so explicit casting is required.
Dont go with how many bits one takes in this scenario rather
you should look at what range of values float and long can contain. float can contain a very huge range of value because number is represented in scientific notation.
See very small example how numbers can be stored in this way:
10000 = 10 * 10^3
100000 = 10*10^4
and so on
The largest number a long can have is 2^63 - 1. Whereas, a float, which is 32 bits shorter than a long, can have up to (2-2^-23)�2^127. Thanks and Regards,
cmbhatt
[ April 07, 2007: Message edited by: Chandra Bhatt ]