division by 7 efficiently ???
Garrick.Peterson at zootweb.com
Garrick.Peterson at zootweb.com
Fri Feb 2 16:00:16 EST 2007
>How to divide a number by 7 efficiently without using - or / operator.
>We can use the bit operators. I was thinking about bit shift operator
>but I don't know the correct answer.
It may not be efficient, but the easiest solution (without using tricks
from a particular languages) is to increment a value within a while loop
which checks it against the target value. More efficient may be to pick an
arbitrary value, and check for greater than or less than, modifying the
range based off your results (much like a recursive search).
However, having done a tour with EA, I would have to say that you're
probably better off not making it. Though they're getting better. =)
Garrick M. Peterson
Quality Assurance Analyst
Zoot Enterprises, Inc.
Copyright © 2007 Zoot Enterprises, Inc. and its affiliates. All rights
reserved. This email, including any attachments, is confidential and may
not be redistributed without permission. If you are not an intended
recipient, you have received this message in error; please notify us
immediately by replying to this message and deleting it from your
computer. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070202/24759937/attachment.html>
More information about the Python-list
mailing list