镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Add checked_* for div and mod functions #57

Open

Description

@JayXon

It's very easy to implement the check wrong, most people only check if denominator is 0, but not i32::MIN / -1.

Activity

  1. cuviper commented on Dec 29, 2023

    @cuviper
    Member

    There are already traits for this: https://docs.rs/num-traits/latest/num_traits/ops/checked/index.html

    But if you're asking for this on Integer, I don't think there's any compatible way to add these as extra methods.

  2. JayXon commented on Dec 29, 2023

    @JayXon
    Author

    Sorry I should've been more clear, I was talking about functions like div_floor, div_mod_floor, mod_floor
    I don't see a trait for checked variants of these

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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