Here is a useful function for anyone needing to convert binary digits to
decimal.  Took me awhile but here it is:

bnfunc:  func [
    "Convert Binary digits to Decimal equivalent"
    bn [string!] "The binary representation"
    /local holder count][
    holder: make integer! 0
    reverse bn
    count: length? bn
    for x 1 count 1 [
        if (to-string (pick bn x)) = "1" [
            holder: (2 ** (x - 1)) + holder
        ]
    ]
return holder

]

Let me know what you think.

I am gonna create some refinements to enhance it a bit.

Paul Tretter

Reply via email to