• Search

Search

  • Main
  • News
  • Forum
  • Videos
    • Video Reviews
    • News
    • Gameplay
  • Reviews
  • Hardware
    • CPU
    • Video Cards
    • Memory
    • Motherboards
    • Storage
    • Headsets
    • Gadgets
  • Staff
    • Deus Qain
    • LittleViking
    • Logan
    • Wendell
  • Community
    • Chat
  • Post
    • Post a Blog
    • New Forum Topic
  • FAQ
    • Rules
  • Store

Basic binary

Hellooooo everyone.  I have been away for a very long time, blame school >.< BUT I’m learning some really cool things in various computer science courses this semester, so I figured I’d share some of those things with you all.  I’ll probably write about one of these posts a week.  I’m guessing that a disproportionate number of these posts will pertain to my computer organization class, which means I’ll be talking lots about hardware and methods of communicating with the hardware.  These posts will mostly be basic, bite-sized crash-courses on the various topics, if you happen to know a lot about the topic of one of my posts then please do elaborate in the comments!  Also, please ask questions if you don’t know what I’m trying to say…Sometimes my brain doesn’t work well after a certain hour, and I will probably be writing most of these posts well after that certain hour.

Anyways, today I will talk about converting decimal to binary and back again.  I assume everyone is familiar with the decimal, or base-ten, numeral system.  One way you could represent a number in decimal is to use positional notation, essentially breaking it up into the “one’s place”, the “ten’s place”, the “hundred’s place”, and so forth.  The numbers filling each of these places can range from 0 through 9.   Positional notation may be easiest to demonstrate by example.  So, say you’re given a number 235.  Another way to represent that number would be: (2 * 10^2) + (3 * 10^1) + (5 * 10^0), which equals 200 + 30 + 5.

Let’s take a look at binary now.  Binary is the base-two numeral system, and only includes the number representations 0 and 1.  Say that you’re given a 5-bit binary number 01001.  This number can also be represented as (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (0 * 2^1) + (1 * 2^0).  Do out the math, you’ll find that the number equals 0 + 8 + 0 + 0 + 1, which is 9.  So there you have a binary representation of the number 9.

Now let’s try going from decimal to binary.  A simple way to do this is to keep dividing the number by two, keeping track of the remainders as they pop up.  I have no idea how to put it in better terms, so how about I just show you an example?  Take the number 235.  This is what it would look like to convert it to binary:

235                remainder
/2   =117       1      <–least significant digit
/2   =58         1
/2   =29         0
/2   =14         1
/2   =7           0
/2   =3           1
/2   =1           1
/2   =0           1      <–most significant digit

Notice how the remainders are all either 0′s or 1′s.  Hmmmm.  So, just line up those remainders in order from most significant digit to least significant digit and you get 11101011.  To check that this is correct, you can write it out in positional notation:
(1 * 2^7) + (1 * 2^6) + (1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (1 * 2^0)
= 128 + 64 + 32 + 0 + 8 + 0 + 2 + 1
= 235

Hooray!  So that is, in a nutshell, how you convert from decimal to binary and back again.  This method works for converting to any other numeral system as well (octal, hexadecimal, etc), except instead of dividing/multiplying by 2 you want to divide/multiply by the respective base number (8 for octal, 16 for hexadecimal, and so forth).

Spread the word or die!
  • Digg
  • Reddit
  • del.icio.us
  • Twitter
  • Mixx
  • Google Bookmarks
  • StumbleUpon
  • Technorati
  • Tumblr
  • LinkedIn
  • Print
  • PDF
  • email
  • Facebook
  • Fark
  • Google Buzz
  • HackerNews
  • N4G
  • RSS
  • Current
  • DotNetKicks
  • Slashdot
  • Webnews.de
  • Gwar
  • NuJIJ
  • Posterous

Related Photos

Posted by littleviking | LittleViking, RTW

13 Comments

  1. Avatar of ztrain
    ztrain
    04 Oct 2011, 11:36 pm

    imo, the easiest way to understand a number system is to count in it.
    for example, in binary:
    0 = 0
    1 = 1
    10 = 2
    11 = 3
    100 = 4
    101 = 5
    110 = 6
    111 = 7
    1000 = 8
    1001 = 9
    ext…

    it makes it easy to understand how each place is a value of base 2, and how you add the places to get the decimal equivalent.

    Log in to ReplyReport user
  2. Avatar of GigaBuster.exe
    GigaBuster.exe
    05 Oct 2011, 1:16 am

    I use basic binary to form cached equations in my head to make basic math easier, think of it like form new instruction sets in your brain since its basically both a CPU and storage
     

    Log in to ReplyReport user
  3. Avatar of Spankks
    Spankks
    05 Oct 2011, 4:08 am

    oh god damn my face just melted off

    Log in to ReplyReport user
  4. Avatar of N-need-of-assistance
    N-need-of-assistance
    05 Oct 2011, 5:08 am

    thats some complicated stuff

    Log in to ReplyReport user
  5. Avatar of Gislur
    Gislur
    05 Oct 2011, 5:46 am

    N-need-of-assistance said:
    thats some complicated stuff

    Nah. It’s quite easy actually. Octa and hexa decimals are a bit worse.

    Just an example of practical use: If you have a micro controller with 8 ports and want all of them open, you give the MC the number 11111111(binary), 255(decimal) or FF(hexa decimal). What a lot of people do wrong here is calculating 11111111 to be 2^8=256. Typing this decimal number would give you the value 100000000 in binary, which would close all the ports except the non-existent ninth port.

    Log in to ReplyReport user
  6. Avatar of Sonata
    Sonata
    05 Oct 2011, 8:17 am

    For binary I was taught that way and then an easier way (if you think of it as an easier way)
    This way requires a bit more scratch but it’s pretty helpful.
    256 128 64 32 16 8 4 2 1
    So you have to think of the above as some sort of yes/no system. If the number is included (and will make it add up to the decimal) then you’ll put a 1 below it, and if not a 0. So if you’re trying to get 234
    256 128 64 32 16 8 4 2 1
    .........1 1 1 0 1 0 1 0

    (formatting is a bit off because they don’t allow tons of spaces. = (but it should be 1:0 2:1 4:0 8:1 16:0 32:1 64:1 128:1)
    All of where it’s 1 is a “yes” (if you think of it more as a circuit works t/f h/l y/n on/off) then the number is added, where it’s a 0 the number is ignored, so your final result is 11101010.

    Log in to ReplyReport user
  7. Avatar of Boov
    Boov
    05 Oct 2011, 11:34 am

    Hey thanks for this! I learnt binary ages ago, and have since almost forgotten it. I’ve got an assignment to do for Computing, this will probably come in handy.

    Log in to ReplyReport user
  8. Avatar of Brian
    Brian
    05 Oct 2011, 11:46 am

    Sonata: For binary I was taught that way and then an easier way…

    Yeah I found this to be easier to understand when first learning about decimal <-> binary conversions.
     

    Log in to ReplyReport user
  9. Avatar of wooly4
    wooly4
    05 Oct 2011, 6:07 pm

    Sonata: For binary I was taught that way and then an easier way

    thats the way I initially learned it, makes alot more sense then all those calculations 

    Log in to ReplyReport user
  10. Avatar of GigaBuster.exe
    GigaBuster.exe
    06 Oct 2011, 1:55 am

    Sonata said:
    For binary I was taught that way and then an easier way (if you think of it as an easier way)
    This way requires a bit more scratch but it’s pretty helpful.
    256 128 64 32 16 8 4 2 1
    So you have to think of the above as some sort of yes/no system. If the number is included (and will make it add up to the decimal) then you’ll put a 1 below it, and if not a 0. So if you’re trying to get 234
    256 128 64 32 16 8 4 2 1
    .........1 1 1 0 1 0 1 0

    (formatting is a bit off because they don’t allow tons of spaces. = (but it should be 1:0 2:1 4:0 8:1 16:0 32:1 64:1 128:1)
    All of where it’s 1 is a “yes” (if you think of it more as a circuit works t/f h/l y/n on/off) then the number is added, where it’s a 0 the number is ignored, so your final result is 11101010.

    yeah thats what they taught us in cisco back in highschool

    Log in to ReplyReport user
  11. Avatar of witteknokkels
    witteknokkels
    06 Oct 2011, 2:24 am

    i should learn basic binary

    Log in to ReplyReport user
  12. Avatar of wooly4
    wooly4
    06 Oct 2011, 8:32 pm

    witteknokkels said:
    i should learn basic binary

    even if your into programming there are very few practical applications of it, but if your like me and just like learning shit like this go for it

    Log in to ReplyReport user
  13. Avatar of skullabyss
    skullabyss
    16 Oct 2011, 8:17 pm

    I’m doing this in my Computer Network Engineering Class right now! it is easy as hell

    Log in to ReplyReport user

Leave a Reply

Click here to cancel reply.

You must be logged in to post a comment.

Log in
Write New Blog
New Forum Post
Register!

Forum Last 9 Discussions

  • Should I buy anew GPU or CPU
    Last Post By: kyle
    Inside: Hardware
  • Need help with AM3
    Last Post By: skullabyss
    Inside: Motherboards
  • Introduce yourself old, and new members!
    Last Post By: TorridSaber
    Inside: General Discussion
  • Where LGA 775 motherboards went? 2012
    Last Post By: skullabyss
    Inside: Motherboards
  • Anyone having trouble with Tek Syndicate
    Last Post By: Dany
    Inside: RazeTheWorld
  • TO ALL RAZETHEWORLD MEMBERS
    Last Post By: skullabyss
    Inside: RazeTheWorld
  • Whats RTW’s opinion on ReactOS?
    Last Post By: Logan
    Inside: General Discussion
  • gtx680 taken apart video
    Last Post By: Jason
    Inside: GPU
  • Need help with Audio
    Last Post By: eastexas
    Inside: General Discussion

Official Posts

PAX East Coverage is ONLY on TekSyndicate
Head over to TekSyndicate.com. All of our PAX East...
SteelSeries Diablo III Mouse Review Video
The Diablo III Mouse from SteelSeries has exceeded my...
SteelSeries Kana Mouse Video Review
SteelSeries was nice enough to send over a few...
Going to PAX East: With whom we’ll be meeting
Hey everyone, PAX East is only about a week...
WhoDat is the New Whois: Rappers Can Now Find Whois Data
Kanye West (the father of intellectualism) has decided to fix...
Tek Syndicate is Almost Ready
We have been working hard on Tek Syndicate. There’s...
New York to Beijing in 2 Hours–Without Leaving the Ground
The Evacuated Tube Transport (ETT) system is supposed to...
Rick Santorum’s Apocalyptic “Obamaville” Video
For your viewing pleasure: Look, I’m not exactly happy...
Evga GeForce GTX 680 Unboxing and Overview Video
Specs Base Clock: 1006 MHz Boost Clock: 1058 MHZ...
Senators Warn About Secret Interpretation of Patriot Act
For years, various (though few) members of Congress have...

Community Posts

You can’t install another OS on a Windows 8 Arm Device!
According to the XDA Developers, Microsoft has not only...
Merry christmas!
Merry christmas all of Raze The World! Spread the...
Jimmy’s Lets Play Skyrim & Skyward Sword
So I’m rebooting my Gaming Channel with Skyrim and...
Jimmy PC Build
After Playing Skyrim on the PC at a friends...
Tech Update #111 High Emotions, Low Energy
Description: It’s Friday, which mean its Tech Update Day,...
The PC Gamer’s Guide to Being Less Annoying
Let’s just get this out of the way:  ...
Malware steals bitcoins
Recently, you might’ve heard that the authourities are chasing...
Cooler Master Sniper Case Mod
Today i did a mod on my new Cooler...
POWERCOLOR LAUNCHES FIRST HD6850 SINGLE SLOT EDITION
Multi-function and performance available in 4 way CrossFireX Taipei,...
Portal 2 CAN be unlocked early!
http://www.aperturescience.com/glados@home/ From the looks of things either the potatoes...

Stalk us on Facebook

  • About
  • Advertise
  • Credits
  • Legal
  • Contact
  • RTW Logos
  • Foobar
© 2010 RazeTheWorld. All rights reserved.
RazeTheWorld
  • Log In
  • Sign Up
  • Visit
    • Random Member
    • Random Group