Fun with BigInts!

This might be the most computer science-y thing that I’ve done in a very long time!

You may be familiar with a limitation of the floating-point number data type that is used in TypeScript. While 64 bits is a lot of room to hold most numbers that we encounter on a regular basis, it’s still a finite amount of room. When you start working with, say, cryptography or big hash functions that use really big numbers, you start to hit the limits of the number data type. To work around these limitations, special libraries are created to hold these large numbers.

Enter BigInt for MakeCode! I ported a portion of Google’s JavaScript (it’s actually written in TypeScript) library for BigInt (a.k.a. JSBI).

You can see the extension in action here:

Now, you may ask, why did I do this? Mwah ha ha ha ha…

If you find any bugs or want any additional features, then please let me know, either here or in GitHub. Feel free to file issues and pull requests there. Have fun!

4 Likes

Oh of course … now I find this:

So many rabbit holes! Looks like I’ll be creating a version two of this library! :smiley: Be on the lookout for namespace BigNums in the near future! Not sure how useful an arbitrary-precision floating point number will be, but why not!

1 Like