Results 1 to 7 of 7

Thread: Convert A Number From Binary (Base 2) Numbering to Decimal (Base 10)

Threaded View

  1. #1

    Thread Starter
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Convert A Number From Binary (Base 2) Numbering to Decimal (Base 10)

    Me being the computer nerd I am, I decided to combine my love of math and love of computers to come up with a single formula that converts a number from base 2 (binary) numbering to base 10 (decimal) numbering.

    There is one thing I would like to note about this formula. Computers think in 8-bit binary and this formula is meant to be used with the binary numbering system. True binary numbering means thats 1101000101110101 is a valid number (53,621). In 8-bit binary it would break into separate 8-digit sections (bytes) like this: 11010001 01110101. These would represent two separate values (209 and 117) instead of just one.

    If anyone has any suggestions on otherways to accomplish this or any imput to add, I would love to hear it.

    EDIT: I uploaded 2 .DOCs. One is a full explanation of the binary formula and the other is an explanation of how to isolate a digit in a number if you are given its position in the number.

    x = Number in binary
    n = Length of that number (how many digits are in it)

    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by eyeRmonkey; Dec 21st, 2005 at 11:09 PM.
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width