Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit measurements shouldn't convert from XiB to XB #16

Open
mmstick opened this issue Oct 24, 2018 · 2 comments
Open

Unit measurements shouldn't convert from XiB to XB #16

mmstick opened this issue Oct 24, 2018 · 2 comments

Comments

@mmstick
Copy link

mmstick commented Oct 24, 2018

let block_sectors = 1953458176;
let size = ByteSize::kib(block_sectors / 2);
println!("{}", size);

Expected Output:

931.48 GiB

Actual Output:

1000.2 GB
@hyunsik
Copy link
Collaborator

hyunsik commented Oct 30, 2018

Your request makes sense for me. In terms of implementation, we will be able to keep the unit as a kind of Enum and use the Enum type to represent the original input unit. But, it will cause the different behavior of the current library. So, let me think about more if there is a better option.

@loyd
Copy link

loyd commented Dec 8, 2024

I hope it won't affect the ByteSize representation (I think it should be a lightweight wrapper around usize). However, a new wrapper, ByteSizeWithUnit, can be introduced to store `size' and the initial unit if it's useful.

However, simple use IEC by default (#37) covers 99% of use cases, so an additional structure is redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants