Thursday, 11 February 2016

Assigning a long value to a float can result in a rounding error.What about assigning long to double? long long to double?

Leave a Comment
Ans:

7. The answer depends on how large the two types are. If long is 4 bytes, there is no loss.That’s because the largest long value would be about 2 billion, which is 10 digits. Because double provides at least 13 significant figures, no rounding would be needed.The long long type, on the other hand, can reach 19 digits, which exceeds the 13 significant figures guaranteed for double.

Reference:

Answers to Chapter Reviews C++ Primer Plus

If You Enjoyed This, Take 5 Seconds To Share It

0 Questions: