division by 7 efficiently ???
John Nagle
nagle at animats.com
Wed Jan 31 22:36:25 EST 2007
krypto.wizard at gmail.com wrote:
> Its not an homework. I appeared for EA sports interview last month. I
> was asked this question and I got it wrong. I have already fidlled
> around with the answer but I don't know the correct reasoning behind
> it.
The answer to that question is that the fastest way to divide
by 7 is to use the divide instruction. You'd have to go down
to a really old 8-bit microprocessor like the Intel 8051 to
find something where bit-twiddling like that pays off.
And no way would this be a win in Python, which is
interpreted.
John Nagle
More information about the Python-list
mailing list