Skip to content

Add documentations about Integer overflows #7

Description

@lizhuohua

Hi, first of all, thanks for the great crate.

However, dealing with large numbers can easily cause integer overflows. For example, the following code would cause a runtime panic for debug build and return a wrong answer for release build:

use byte_unit;
fn main() {
    println!("{}", byte_unit::n_zb_bytes(std::u128::MAX));  // integer overflow
}

Prabably it is better to add more documentations to illustrate under what conditions these functions would not work properly.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions