|Keep It Simple, Stupid|
Re: Re: Alpha base-26 to base-10...by Boots111 (Hermit)
|on Jul 01, 2003 at 05:45 UTC||Need Help??|
I am surprised that no one else has mentioned this (because some have done it in their code), but this is the sort of situation where you want to avoid using exponentiation (be it pow or **). You should notice that the correct power can be built up by repeatedly multiplying by 26 during each pass through the loop. Making your code into:
While a really good optimizer *might* do this for you, I doubt that many do, and I am relatively certain that Perl won't since it is so heavily introspective. This is the sort of optimization I always keep my eyes out for cause it can save a lot of work.
Computer science is merely the post-Turing decline of formal systems theory.