Big Number Calculator

Description. An online 100, 500, 1000, and 5000 digit arbitrary-precision, arbitrary-radix calculator, originally written in JavaScript using BigInt.js.

Background. This project served as an excuse to brush up on math skills such as long division. Then it progressed into estimating square root by hand. At the time, it required reinventing squares and roots as fractions--and then doing it all in JavaScript. But having experience with 6510 Assembly language for the Commodore64 using early versions of Vision BASIC or SuperCPU made it not that much of a big deal.

Optimization. Timing the results of calculations and testing improvements took several hours. The code probably contains a better root estimation algorithm than ones that are currently used. But estimating long decimal roots in big number bases still takes a long time in JavaScript!

Future improvements. Now that JavaScript supports BigInt natively, there is a plan to eventually use native methods. The difficulty with converting is that this long number base calculator works with any number base. BigInt does not. It takes extra steps to convert between different number bases in the same calculation. It can estimate the nth root of a large number in arbitrary number bases up to base 2047. (Base 2 to 93 use the standard ASCII charset. Bases from 94 to 2047 of course use the utf-8 charset.) Big Number Calculator calculates arbitrarily-long decimal numbers by representing them internally as big fractions.

Of course there are fundamentally better ways to go about this. Whether or not it is worth it depends on how much interest is generated. Code could be compiled to run natively in the browser. That would reduce load on servers and leverage close to the full power of the CPU, or even the GPU. Work could commence using any of the following tools.

This project was inspired by our other project, the 1,000,000 digit calculator which is written in PHP. Check out our other page of calculators.


CCBY Copyright © 2025 Henry Kroll III, thenerdshow.com This web page is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.