good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: reliable get position of leftmost bit in large integersby hdb (Monsignor) |
on Mar 12, 2015 at 10:42 UTC ( [id://1119768]=note: print w/replies, xml ) | Need Help?? |
Should your code not be:
which gives no output for me. UPDATE: Apologies, I think I get it now, the leading one of 2^i - 1 should be in the same place as the leading one for 2^(i-1) which is what you are testing. My next thought was to use length(sprintf("%b",$x)) but that does not work either:
In Section
Seekers of Perl Wisdom
|
|