Skip to content

Integer division/remainder rounding behavior should be documented #26845

Closed
@wthrowe

Description

@wthrowe

Using Google I can find lots of old arguments over how integer division should work in Rust, but I cannot find anything in the reference, the API docs for the integer types, or the API docs for the Div trait that says what was actually decided. (And the documentation seems to imply that /, checked_div, and wrapping_div may not all do the same thing.) This is further confused by the integer type documentation apparently sometimes using / to refer to integer division and sometimes to mathematical division. (I can't come up with out any other reasonable interpretation of floor(self / other) in the wrapping_div documentation.) It would be nice if this were clearly documented somewhere, since this varies between languages and is one of the main confusions with integer arithmetic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions