1125899906842620 bytes gives the result of 1024 TB because of rounding
See original GitHub issueI see the only way of solving it – very inelegant corner case management.
let res = parseFloat((bytes / (1024 ** pow)).toFixed(precision));
if (res === 1024) {
res = 1;
pow++;
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Does .NET provide an easy way convert bytes to KB, MB ...
Here is a fairly concise way to do this: static readonly string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", ......
Read more >Convert Bytes to Petabytes - Digital Storage Conversions ...
Online calculator to convert Bytes to Petabytes (B to PB) with formulas, examples, ... Bytes ÷ 1,125,899,906,842,620 = 0.0026645352591 Petabytes Result: ...
Read more >Kilobytes Megabytes Gigabytes Terabytes
In this section, we'll look at common sizes you would see in real life and learn how to reason about various numbers of...
Read more >Solved: How to write a search to convert bytes to KB, MB
Doing the recv_bytes/1024/1024 is converting your byte count to MB and skewing your results. Leave the formatting of the values to later.
Read more >What is petabyte? | Definition from TechTarget
A petabyte is a measure of memory or data storage capacity that is equal to 2 to the 50th power of bytes. There...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Without a changelog, the only way to determine if an upgrade is “safe” or not is to look at the commit log, which I was doing. And clearly I failed to understand this change at first look.
I’m not arguing with you whether providing a changelog is a good thing or not, I’m merely giving people (who look for the details of an update, people like me) a better understanding of this issue and that’s it, what’s so wrong about that? This is what I saw, and how I came to this issue, and it only makes me confused because 1125899906842620 is clearly not equal to 1PB. Your test case is even more confusing (to me at least). So that’s why I decided to leave a note to future readers.
Btw, providing a changelog is not that difficult, you may want to look into conventional commits and semantic release
https://en.wikipedia.org/wiki/Changelog <— seriously stop being so entitled with the notion of the changelog already, and either land it or stfu.
https://devhints.io/git-log <-- this is required reading