News for hackers. Stuff that matters.
Re:Write A Function To Determine If A Number Is A Power Of 2 by darwinGod on Monday October 18, 2010 @01:26PM (#1804341)
That's definitely true- but say you want to check for (+/-2)^n, then you would have to deal with negative numbers.

If you go by the Two's complement representation, then for a negative number say (-8), because of sign extention, a check for x&(x-1) would fail.

There are no comments on this comment yet.