-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Description
The two base values are backwards. This leads to the selection of the wrong unit; values larger than 1000 or lower than 1.0 can be displayed, e.g. "1090.0 GB" or "0.9 TiB".
use bytesize::ByteSize;
fn main() {
println!("{}", ByteSize::gib(940).to_string_as(true));
println!("{}", ByteSize::gb(940).to_string_as(false));
println!("{}", ByteSize::gib(1090).to_string_as(true));
println!("{}", ByteSize::gb(1090).to_string_as(false));
}
// Output: Expected output:
// 0.9 TiB 940.0 GiB
// 940.0 GB 940.0 GB
// 1.1 TiB 1.1 TiB
// 1090.0 GB 1.1 TB
Metadata
Metadata
Assignees
Labels
No labels