lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Norbert Kiesel wrote:
On Sat, 2010-01-09 at 02:04 +0800, KHMan wrote:
Norbert Kiesel wrote:
[snipped all]

Yeah, tabs went missing.  I include an untabbed version below (otherwise
unchanged).  Regarding the "real slow": it is guaranteed to decrease the
length of the decimal every round (due to the div:match() at the
bottom), so it's O(n^2).  Can you come up with something better?

The algorithm still works if you calculate for multiple hex digits at a time, e.g. using 65536 will get you 4 hex digits at a time. I think it works with 24 bits at a time too (53/2 > 24, still safe). You can grab more source digits at a time too. Curious... going to find some of those arbitrary prec code to learn something new...

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia