+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: Binary, Decimal, Hex, the Manual way!!

  1. #1
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Binary, Decimal, Hex, the Manual way!!

    Introduction:-
    Well I like to make things manually! Why? Because that gains me more knowledge! In this tutorial we will go low-level and I will explain how to convert Binary, Decimal and Hex! might seem useless but it is NOT! but you can always impress your friends you will know more about the actual Pc background!
    NOTE:- IF YOU WANT TO FULLY UNDERSTAND THIS YOU WILL NEED SOME GOOD BACKGROUND OF THESE THINGS!!

    Let's Start:-

    First of all you will need to know some basic things about Binary. Decimal and Hex digits

    Binary:- Contains only 1's and 0's as digitals
    Decimal:- Contains any whole numbers ( 9, 255, 15265789 anything! as long as it is whole )
    Hex:- Contains 0-9 and then A to F ( A to F represent 10 to 15 )

    Converting Binary to Decimal:-
    So lets say you have this binary number 11101, what does that mean in Decimal?
    Here is how
    So we make like this:-

    Code:
    16    8    4    2    1    <-- We duplicate the number
     1    1    1    0    1    <-- Binary number
    Now where there is a one (1) in the binary number we add the top number that is representing it so here we have a 1 under the numbers 16, 8, 4, 1
    So we add that number and ignore the other numbers that under them is a 0 so we make

    16+8+4+1=29
    So the binary number 11101 in Decimal ( numbers that we understand ) it means 29!

    Converting Decimal to Binary:-
    This is the opposite but it has a different method to do it! we will take the previous number (29) so to proof that this works

    We will take the number 29 and divide it by 2 until the answer reaches 0 and where there is a remainder we write one (1) where there is no remainder we write zero (0)

    and we write the number from bottom to top so it reads 11101 huh? the number matches with the previous method of Binary to Decimal!

    Converting Binary to Hex:-
    Now we will take the number 11101
    Here we will have to divide the Binary into 4-Bit numbers
    Code:
    1  |  8    4    2    1    <-- Here we have 4-Bits and 1-Bit ( doubling the number )
    1     1    1    0    1    <-- Binary Number
    Answer is 1 and ( 8+4+1 ) we add the numbers where there is 1
    so its 1 and 13
    so in HEX its 1C ( because A =10, B=12, C=13, D=14, F=15 and it stops )

    Converting Hex to Binary
    Lets say we have this Hex Number
    A4
    We know that A=10
    so we make

    Code:
     A                                 4          <-- Hex
    10                                 4                
    8    4    2   1    |    8    4    2   1   <-- 4-Bit Number
    1    0    1   0    |    0    1    0   0   <-- **
    ** = We make 1 under those numbers that add up to the number on top of them for example 8+2 make 10 so we make 1 under the 8 and 2 and 0's under the others! So A4 in Binary is 10100100

    Converting Hex to Decimal:-
    Here we will have to convert the HEX into Binary ( as shown previously ) and then make:-

    Code:
    128    64    32    16    8    4    2    1     <-- We double the number
      1     0      1     0     0     1   0     0     <-- Write the Binary Number
    and we add the numbers that have 1 under them so its 128+32+4=164
    so A4 in Decimal means 164!

    Converting Decimal to Hex

    Here we made like normal Decimal to Binary now we have to add
    And normal Binary to Hex!

    Conclusion:-
    Well it's a long tutorial and it's too complicated I know but well can't be better! hope this helps!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    xtraze is offline Programming God
    Join Date
    Dec 2006
    Location
    Sri lanka
    Posts
    911
    Rep Power
    0
    C'mon man, This is mathematics and I have done this at school a lot of times, But I never knew the Hex. its 15, wow!.

  4. #3
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    Quote Originally Posted by xtraze View Post
    C'mon man, This is mathematics and I have done this at school a lot of times, But I never knew the Hex. its 15, wow!.
    Lol conversions are not just Mathematics! So you did this at school and didn't know that HEX was 15 rotfl! thats strange

  5. #4
    xtraze is offline Programming God
    Join Date
    Dec 2006
    Location
    Sri lanka
    Posts
    911
    Rep Power
    0
    Hey, I study in school in sinhalese and I never knew the word HEX, that's all. But I knew these number stuff very well. Very simple mathematics they are.

  6. #5
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    Quote Originally Posted by xtraze View Post
    Hey, I study in school in sinhalese and I never knew the word HEX, that's all. But I knew these number stuff very well. Very simple mathematics they are.
    So how do you know how to convert it to Binary and Decimal if you never knew the word HEX?

  7. #6
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143
    You can use that process for any base. Babylonians used base 60. Mayans used a variation on base 20.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  8. #7
    AfTriX is offline Programming God
    Join Date
    Jan 2007
    Location
    Chicago
    Posts
    586
    Rep Power
    0
    Why do you all mess up with these conversion stuff, rather just using a simple calculator? I navigate you guys to step-in to VB Tutorials to check my basic calculator tutorial.

  9. #8
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    Umm I like to make things manual as that would increase my knowledge!

  10. #9
    AfTriX is offline Programming God
    Join Date
    Jan 2007
    Location
    Chicago
    Posts
    586
    Rep Power
    0
    Quote Originally Posted by Tcm9669 View Post
    Umm I like to make things manual as that would increase my knowledge!
    Oh then you must be a big headed huh??? LOL..

  11. #10
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143
    Most calculators won't do ternary.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

+ Reply to Thread
Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Decimal To Binary
    By neshkid123 in forum Java Help
    Replies: 15
    Last Post: 10-13-2011, 03:44 PM
  2. decimal to binary number
    By AstralX in forum Java Tutorials
    Replies: 11
    Last Post: 06-14-2010, 02:54 PM
  3. Convert Binary Integer to Decimal
    By Kinsleyy in forum Java Help
    Replies: 10
    Last Post: 02-12-2010, 12:25 PM
  4. Using stacks to convert from decimal to binary
    By J-Camz in forum C and C++
    Replies: 5
    Last Post: 06-15-2009, 12:23 PM
  5. Binary to Decimal and back
    By atomicSpatule in forum C# Programming
    Replies: 2
    Last Post: 03-28-2007, 09:43 AM

Tags for this Thread

Bookmarks

Posting Permissions

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