You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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;fnmain(){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.
The text was updated successfully, but these errors were encountered:
use byte_unit::{Byte,Unit};fnmain(){println!("{:?}",Byte::from_u128(1 << 80));// returns `None` if the `u128` feature is not enabledprintln!("{:?}",Byte::from_u128(u128::MAX));// returns `None` even if the `u128` feature is enabledprintln!("{:?}",Byte::from_u64_with_unit(1_000_000_000,Unit::TB));// returns `None` if the `u128` feature is not enabledprintln!("{:?}",Byte::from_u64(u64::MAX).multiply(2));// returns `None` if the `u128` feature is not enabled}
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:
Prabably it is better to add more documentations to illustrate under what conditions these functions would not work properly.
The text was updated successfully, but these errors were encountered: