ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(int(1e308) > 10**308, float('1e-400'), 5e-324 / 2, 5e-324 / 2 == 0)
  1. A. False 0.0 0.0 True
  2. B. True 0.0 5e-324 True
  3. C. True 0.0 0.0 False
  4. D. True 0.0 0.0 True

Correct answer: D. True 0.0 0.0 True

The float 1e308 is stored as a binary value slightly above the decimal one, so int of it exceeds 10**308. Halving the smallest subnormal rounds to zero, which is a tie to even.

More Python Programming questions

Exams that ask this topic