Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: How can I tell if a number is a power of 2?by archen (Pilgrim) |
on Jan 28, 2002 at 23:12 UTC ( [id://142151]=note: print w/replies, xml ) | Need Help?? |
err, I have no idea how this would benchmark, but couldn't you do You'd pay a penalty in the calculation, but by the time you get done with sprintf, pattern matching, and a conditional I think the gap would be a lot closer. Originally posted as a Categorized Answer.
In Section
Seekers of Perl Wisdom
|
|