There’s some code here: Functions to work with ridiculously big numbers. | Uefn Code Snippet
hope that helps!