Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^5: converting binary to decimal

by tybalt89 (Monsignor)
on Jun 06, 2025 at 15:28 UTC ( [id://11165291]=note: print w/replies, xml ) Need Help??


in reply to Re^4: converting binary to decimal
in thread converting binary to decimal

The first tr/// converts each digit to the least significant digit you get when you multiply that digit by 2. The second tr/// produces the carry bit for each digit product. The bitwise 'or' adds the carry to the next higher digit (because of the concatenation of the new bit).

It's sort of like how you were doing the multiply by 2, but with a better handling of the carry. Because we are only multiplying by 2 there never will be a chained carry (where a carry causes another carry, similar to 4999+1).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11165291]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2025-11-07 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (65 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.