https://parallel101.github.io/cppguidebook/cpp_tricks/ 地板除与天花板除中描述C 语言默认的就是地板除。 这里的描述应该有问题吧,c语言的除法应该是截断除法(Truncated Division)。。 ``` 7/3 = 2 -7/3 = -2 ``` python 整除默认的是地板除法。 ``` 7//3 = 2 -7//3 = -3 ```
Activity
IEXPECTATION commentedon Feb 1, 2025
看了 cppreference。从 c99 开始是向 0 截断。https://en.cppreference.com/w/c/language/operator_arithmetic