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.

Why does this keep adding different numbers?

See original GitHub issue

For an example add a 9 to this 999999999999999 and it will be converted to 10,000,000,000,000,000, even adding very long numbers get changed, this isn’t great for a web app dealing with money…

I can’t see any docs revealing why this is happening or how to stop it, tried decimalScale={undefined}, nothig changed…

Please, help

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
cchanxzycommented, Apr 22, 2021

Hi, thanks for getting in touch.

Yes, I am aware there are some issues when a large digit number is entered. It was never my intention to handle large numbers like 999999999999999 so I’ve never really looked into handling it to be honest.

In the future I might implement a solution, but if you’re in a rush I would recommend either:

Sorry my reply isn’t particularly helpful.

0reactions
ItsShadowlcommented, Apr 22, 2021

Hi, glad to hear from you… The issue has been affecting other parts of my dev since 2 days now(mostly my fault since i don’t like proceeding with development when there’s a pending bug to fix)

I had a fork pulled and started implementing the solution using bignumber.js library for all number-based implementations…

I’m done with it though, been testing to be sure i didn’t break anything…

Thanks for all suggestions, i’m unable to avoid large numbers since i’m in the finance sector.

After rigorous testing, i figured the react-number-format i mentioned also faced the same issue and going deep into the code, i saw it uses parseFloat even in more lines than yours 😊

I appreciate your work on the library and it was as simple and advanced as i want, kinda have all features i wanted.

If you want, i can upload the fork to github(not yet to avoid it competing with your library), maybe it might help you solve a major problem for many people facing same issue, just that you now have bignumber.js as a dependency.

Good luck and thanks again

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the name of the number that is being added to another ...
In a case when you are adding exactly two numbers, you can use augend and addend, to refer to the first and second...
Read more >
Techniques for Adding the Numbers 1 to 100 - BetterExplained
By counting from 0, we get an “extra item” (10 in total) so we can have an even number of rows. However, our...
Read more >
Adding Fractions with Unlike Denominators | Math with Mr. J
Mr. J will go through two adding fractions examples and explain the steps of how to add fractions with unlike denominators.
Read more >
3 NUMBER: WHAT IS THERE TO KNOW? | Adding It Up
Later, other numbers are introduced: negative numbers and rational numbers (fractions and mixed numbers, including finite decimals). Children expend ...
Read more >
Add different page numbers or number formats to different ...
You can use any other format instead. Select between the intro and the body of the document and go to Layout > Breaks...
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