Why do Python's math.ceil() and math.floor() operations return floats instead of integers?

前端 未结 8 1936
刺人心
刺人心 2020-12-04 15:11

Can someone explain this (straight from the docs- emphasis mine):

math.ceil(x) Return the ceiling of x as a float, the small

8条回答
  •  醉梦人生
    2020-12-04 15:30

    Because python's math library is a thin wrapper around the C math library which returns floats.

提交回复
热议问题