Determining combination of bits

Grant Edwards grante at visi.com
Mon Nov 8 19:34:30 EST 2004


On 2004-11-08, Josiah Carlson <jcarlson at uci.edu> wrote:

>> The least significant bit of 110 is this one here -----+
>>                                ^                       |
>>                                |                       |
>>                                +-----------------------+
>> 
>> It's a 0 (zero).
>> 
>> What I think you're trying to say is something like the value
>> of the rightmost 1.
>
> From what I remember of high school chemistry (7 years ago), we used to
> talk about 'significant figures' quite often.  If the teacher asked for
> some number to 5 significant figures, it had better have them...
>
> sig_fig(83737256,5) -> 83737000
> sig_fig(1,5)        -> 1.0000
>
> etc.
>
> Now, in the case of 'least significant bit of n', that can be
> interpreted as either n&1, or the rightmost bit that is significant
> (nonzero).
>
> The n&-n produces the rightmost bit that is nonzero, which is certainly
> a valid interpretation of 'least significant bit of n'.

Perhaps it's "valid", but in 25+ years of doing hardware and
low-level software this is the first time I've ever heard the
phrase "least significant bit" refer to anything other than the
"rightmost" bit (the one with a weighting of 1).

-- 
Grant Edwards                   grante             Yow!  When you get your
                                  at               PH.D. will you get able to
                               visi.com            work at BURGER KING?



More information about the Python-list mailing list