Re:Ten Ways to Check if an Integer Is a Power Of Two in C
by omaranto on Tuesday July 26, 2011 @11:27AM
(#2807756)
It seems bizarre to call the first group of methods "decimal based" when the methods don't ever look at the decimal digits of the number being tested. I would call them "arithmetic" or something like that.
[ Parent
| on HN ]
Re:Ten Ways to Check if an Integer Is a Power Of Two in C
by tesseract on Tuesday July 26, 2011 @12:43PM
(#2808187)
Or "representation independent", although the ones that rely on the number being less than INT_MAX obviously rely on some knowledge of the representation.
Re:Ten Ways to Check if an Integer Is a Power Of Two in C
by rcfox on Tuesday July 26, 2011 @11:39AM
(#2807819)
It's decimal as in base 10, as opposed to binary.
Re:Ten Ways to Check if an Integer Is a Power Of Two in C
by eru on Tuesday July 26, 2011 @11:43AM
(#2807847)
But they aren't in base 10. The constant mentioned might as well have been put into the code in hex or octal and nothing would have changed. (I don't know whether C support binary constants.)