Suggestion-Box
Suggestion-Box copied to clipboard
Creating a Javascript to do math on huge numbers.
The largest number that JavaScript can handle is 9007199254740991. Years ago I had a personal website and created a script to do addition, subtraction, multiplication, and division on practically unlimited size positive integers. I do one column at a time like someone doing it on paper. I still have the script and wonder if it would be a good challenge. Details on request.
Aren't their existing libraries available like bigint
There are libraries but there are for a lot of things Coding Train covers, it's not about doing it better but rather about showing how such things work so people understand them.
There's a weird but kinda awesome algorithm to double the precision of floating point numbers that could be coded up in JS
https://www.youtube.com/watch?v=6OuqnaHHUG8
it's kind of better than going column by column and I'm sure it could be extended to arbitrary precision (possibly by recursion)
Doing it as part of a series like 'build your own calculator' would be kind of awesome