Categories
October Surprise 2024

Long is of size 8 bytes then how can it be ‘promoted’ to float(4 bytes …

long uses more bytes, but it has a smaller range: while long cannot go above 2 63, float can go to about 2 127. Obviously, the expansion of range comes at the price of lower precision, but since the range of float is larger, the conversion from long to float is a promotion.