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

Rounding bug between 1001 and 1023 in binary mode #82

Open
ValentinSteiner opened this issue Jan 30, 2024 · 0 comments
Open

Rounding bug between 1001 and 1023 in binary mode #82

ValentinSteiner opened this issue Jan 30, 2024 · 0 comments

Comments

@ValentinSteiner
Copy link

There seems to be a rounding bug when using the binary option:

Input Actual output Expected output
1001 1000 B 1001 B
1023 1020 B 1023 B
1037263 1010 KiB 1013 KiB
1051013543 1000 MiB 1002 MiB
1054331017 1010 MiB 1005 MiB

Code:
prettyBytes(input, {binary: true})

It appears that the number is rounded to a multiple of ten.
It looks like this only happens for outputs between 1001 and 1023 (inclusive).

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

1 participant