Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Tutorials

Tutorials Programming Tutorials - Post your tutorials here!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-31-2006, 01:15 PM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Credits: 0
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Default 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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-02-2007, 01:23 AM
xtraze xtraze is offline
Programming God
 
Join Date: Dec 2006
Location: Sri lanka
Posts: 921
Credits: 10
Rep Power: 0
xtraze is on a distinguished road
Send a message via MSN to xtraze Send a message via Skype™ to xtraze
Default

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!.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-02-2007, 03:24 AM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Credits: 0
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-03-2007, 10:17 AM
xtraze xtraze is offline
Programming God
 
Join Date: Dec 2006
Location: Sri lanka
Posts: 921
Credits: 10
Rep Power: 0
xtraze is on a distinguished road
Send a message via MSN to xtraze Send a message via Skype™ to xtraze
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-03-2007, 10:23 AM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Credits: 0
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Default

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 01-03-2007, 12:46 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,230
Last Blog:
wxWidgets is NOT code ...
Credits: 2,631
Rep Power: 35
WingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to all
Default

You can use that process for any base. Babylonians used base 60. Mayans used a variation on base 20.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-05-2007, 12:07 PM
AfTriX AfTriX is offline
Programming God
 
Join Date: Jan 2007
Location: Sri Lanka
Posts: 596
Credits: 2
Rep Power: 0
AfTriX is an unknown quantity at this point
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-05-2007, 12:15 PM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Credits: 0
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Default

Umm I like to make things manual as that would increase my knowledge!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-05-2007, 12:39 PM
AfTriX AfTriX is offline
Programming God
 
Join Date: Jan 2007
Location: Sri Lanka
Posts: 596
Credits: 2
Rep Power: 0
AfTriX is an unknown quantity at this point
Default

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..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 01-05-2007, 12:54 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,230
Last Blog:
wxWidgets is NOT code ...
Credits: 2,631
Rep Power: 35
WingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to all
Default

Most calculators won't do ternary.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing to binary file paul. Pascal/Delphi 4 04-13-2007 09:23 PM
Binary to Decimal and back atomicSpatule C# Programming 2 03-28-2007 12:43 PM
Determine if a file is binary Nightracer C# Programming 5 09-16-2006 03:26 PM
Binary? NeedHelp Managed C++ 4 07-27-2006 03:59 PM
Binary Conversion in VB roger Visual Basic Programming 0 06-01-2006 11:50 AM


All times are GMT -5. The time now is 04:19 AM.

Contest Stats

WingedPanther ........ 2630.54
Xav ........ 2576.41
Brandon W ........ 1697.27
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 959.05
dcs ........ 646.09
Steve.L ........ 475.59
orjan ........ 407.96
chili5 ........ 378.6

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads