[work] python中的除法,取整和求模

首先注明:如果没有特别说明,以下内容都是基于python 3.4的。 先说核心要点: 1. /是精确除法,//是向下取整除法,%是求模 2. %求模是基于向下取整除法规则的 3. 四舍五入取整round, 向零取整int, 向下和向上取整函数math.floor, math.ceil 4. //和math.floor在CPython中的不同 5. /在python 2 中是向下取整运算 6. C中
相关文章
相关标签/搜索