On Wed, Sep 04, 2002 at 10:16:08AM +0100, Angus Leeming wrote:
> >     while(nsnippets =>> 1) {
> >             ++i;
> >     }
> >     ndigits = 1 + i / 3;
> >
> > That is, the above is an integer approximation of :
> >
> >     ndigits = ceiling(log2(nsnippets)/log2(10));
> 
> Thanks, Allan. I'll have to sit down and think about this. I'm totally 
> useless when it comes to shift operations.

The loop basically gives you the highest one bit in the binary
representation, and he believes that three binary digits fit into a
decimal. Which is not unreasonable...

André

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)

Reply via email to