News for hackers. Stuff that matters.
Re:Ten Ways to Check if an Integer Is a Power Of Two in C by zxw on Tuesday July 26, 2011 @12:12PM (#2808001)
I'm not doing power == int(power) though which is what he warns against. I haven't done a lot of testing however as far I can tell it's working.

    >>> is_power_of_two(2 ** 31 - 1)
    False
    >>> is_power_of_two(2 ** 31)
    True
    >>> is_power_of_two(2 ** 31 + 1)
    False

    >>> is_power_of_two(2 ** 548 - 1)
    False
    >>> is_power_of_two(2 ** 548)
    True
    >>> is_power_of_two(2 ** 548 + 1)
    False
Re:Ten Ways to Check if an Integer Is a Power Of Two in C by eru on Tuesday July 26, 2011 @02:03PM (#2808618)
Yes. It seems to work for much larger numbers than this on my version of Python, but going via doubles leaves a bad taste.