4 ms·
Negative numbers cannot be powers of two.
by nevinera 16y ago
Negative numbers cannot be powers of two.
- darwinGod 16y agoThat'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.