I once wrote a tool called vpi2english. This is part of my vl toolkit written in Matlab. But the code is pretty simple and can be converted to another language if you choose. It essentially takes a (decimal) digital string, breaks it into pieces three digits at a time, and writes them each in words.
>> vpi2english(vpi('2331546567543686356564321')) ans = two septillion, three hundred thirty one sextillion, five hundred forty six quintillion, five hundred sixty seven quadrillion, five hundred forty three trillion, six hundred eighty six billion, three hundred fifty six million, five hundred sixty four thousand, three hundred twenty one
It currently works with numbers equal to 1 less than 1e306, which is so large that I can find names for such numbers on the Internet.
>> vpi2english(999999*vpi(10)^300) ans = nine hundred ninety nine centillion, nine hundred ninety nine novemnonagintillion
user85109
source share