question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1125899906842620 bytes gives the result of 1024 TB because of rounding

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
zypA13510commented, Oct 8, 2019

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

1reaction
avoidworkcommented, Oct 7, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found