Question 7
Back to Exercise
Up to which value can a float represent every integer exactly?
- A 2¹⁶ = 65 536
- B 2³¹ − 1
- C 2²⁴ = 16 777 216 Correct
- D 2⁵³
Correct Answer: Option C
A float has 24 significant bits, so all integers up to 2²⁴ are exact; 16 777 217 rounds to 16 777 216. For double the limit is 2⁵³ – which is also why JavaScript's "safe integers" stop there.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!