Author belopolsky
Recipients belopolsky, mark.dickinson, rhettinger, stutzbach
Date 2010-05-12.03:44:57
SpamBayes Score 2.6403e-06
Marked as misclassified No
Message-id <AANLkTilTpAqy59ez3UhAu4wLA9QAMLUgsOeBuU__CDli@mail.gmail.com>
In-reply-to <AANLkTikg3ykV7gmbvWzBaeH0CFT0v5iXByehtDt3ywmo@mail.gmail.com>
Content
On Tue, May 11, 2010 at 10:19 PM, Alexander Belopolsky
<report@bugs.python.org> wrote:
..
> Similarly, while unlikely to improve performance, I would prefer not
> to use any bit-trick implementation of ilog2 (in a separate function,
> of course) instead of calling floating point log2.  In my head, an
> assignment of floating point result to an integer variable always
> raises a red flag.
>

Searching for relevant past issues, I've come across a similar
sentiment from Mark:

"""
floor(log(n, 2)) is poor code.  This is not supposed to be a dramatic
statement, just a statement of fact.  Its correctness is dependent on
minute details of floating point.  It is poor code in exactly the same way
that "while x < 1.0: x += 0.1" is poor code---behaviour in boundary cases
is almost entirely unpredictable.
""" - msg78066 - Mark Dickinson -

I also noticed that the reference implementation does not require this
calculation because the loop is implemented recursively.  Did you find
recursive implementation to give worse performance?
History
Date User Action Args
2010-05-12 03:45:00belopolskysetrecipients: + belopolsky, rhettinger, mark.dickinson, stutzbach
2010-05-12 03:44:58belopolskylinkissue8692 messages
2010-05-12 03:44:57belopolskycreate