3 ms·
It is... if you're the kind of person who does bit twiddling. And for everyone else it's gobbledygook. Basically, you're using a binary representation, so eve
by moomin 9y ago
It is... if you're the kind of person who does bit twiddling.
And for everyone else it's gobbledygook.
Basically, you're using a binary representation, so everything is in powers of two. Let's just talk integers. 2^n is just the nth bit set and a bunch of zeros. Every number between 2^n and 2^n+1 has the nth digit set and some lower digits. The log base 2 is between n and n+1. So the floor is n. So, biggest digit set=floor of log base 2.
Once you've grasped that principle, the exact details are, in fact, clear. :)
- mikeash 9y agoTo bring it into less computery terms, it's basically the binary equivalent of the statement that the floor of base 10 log of x is the number of decimal digits in x. The floor of log10 9823 is 4, the floor of log10 874323 is 6, etc. This is, I hope, clear. At least if you understand what log base 10 means.