Originally posted by Mr. Multeon:
long L =10;
float f = L; --->[b]Doesnt throw error ? why??
This is still considered as promotion. Remember the primitive type heirarchy? So you are still going 'up the chain', so to speak.
A floating point is stored in exponential form. So its accuracy will depend on how many bits are allocated for its mantissa and exponent(I don't know exactly how much for
Java)
So assigning long to float is still OK. It will just convert it to its exponential form. However, this does not guarantee that it can preserve the original value. Precision may still be lost.