C++ 与 python 整数除法差异

摘要: -1/20=?C++ 里面结果是 0Python 里面结果是 -1 Python里面的注意事项里面,也提到了这点“总是向负无穷取整” For (plain or long) integer division, the result is an integer. The result is always rounded towards minus infinity: 1/2 is 0, (-1)/2 is -1, 1/(-2) is -1, and (-1)/(-2) is 0. Note that the result is a long integer if either operan... 阅读全文
posted @ 2012-02-16 14:09 JesseFang 阅读(535) 评论(0) 推荐(0)