Skip to content

C语言默认应该是截断除法 #81

@CKCat

Description

@CKCat

https://parallel101.github.io/cppguidebook/cpp_tricks/ 地板除与天花板除中描述C 语言默认的就是地板除。

这里的描述应该有问题吧,c语言的除法应该是截断除法(Truncated Division)。。

7/3 = 2
-7/3 = -2

python 整除默认的是地板除法。

7//3 = 2
-7//3 = -3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions