Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: Re: Alpha base-26 to base-10...

by jmcnamara (Monsignor)
on Jul 01, 2003 at 17:05 UTC ( #270547=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Alpha base-26 to base-10...
in thread Alpha base-26 to base-10...


this is the sort of situation where you want to avoid using exponentiation (be it pow or **.

I guess you mean that it should be avoided because exponentiation is an expensive operation.

In the code above there would only be at most two iterations through the loop so the effect is small. Nevertheless, it is still easy to avoid it as you have shown.

I wrote that code more than two years ago. If I had to write it again I would probably approach it in the same way. But I would like to have come up with something like sauoq's solution which I think is the nicest solution in this thread (apart form bwana147 golf). ++ in both cases.

--
John.


Comment on Re: Re: Re: Alpha base-26 to base-10...
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://270547]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2015-07-05 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls