Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org Decimal to Binary to Hex howto
 Linux - Newbie This Linux forum is for members that are new to Linux. Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

 03-05-2009, 12:14 PM #1 Gortex Member   Registered: Nov 2005 Location: Enid Ok Distribution: ubuntu 64 , debian , fedora core , vista ultimate 64, Winows 7 64 ultimate :p Posts: 219 Rep: Decimal to Binary to Hex howto After looking on line at the diffrent tutorials on decimal to hex conversions, I decided that they were overly complicated. So to help some new people out I thought I would show the easy way to do this. Code: ```Here is our decimal ip address 192.168.0.1 How to convert First start on a peace of paper and write out these numbers 128 64 32 16 8 4 2 1 what these are are the decimal values of the diffrent bits in an octet ( 8 bytes) now on to the conversion 192 first step is start on the left hand side of our number list and subtract from the number 192 - 128 = 64 so what I am going to do here is record that there was enough to subtact 128 from 192, by placing a 1 in the 128 slot so now my table looks like this 128 64 32 16 8 4 2 1 1 now I will subtract the next value from the remainder which is 64. 64 - 64 0 so now the table looks like this 128 64 32 16 8 4 2 1 1 1 now their is nothing left to subtract so all your other values will = 0 now you have a binary address of 11000000 these numbers from an octet which is 8 bits. To convert from hex all you need to do is divide this in to two nibbles (4 bits) niba nibb 1100 0000 the values work the same from the right hand side it is 1 2 4 8 so nible a has the 8 and the 4 place lit up add those two numbers togeather to come up with 12 12 in hex = c nible b has no places lit up so it is 0 0 in hex = 0 your hex value fro this number is c0 now you have 192 in decimal 11000000 in binary and c0 in hex. now to convert hex in to decimal just follow these steps backwards.... c0 c = 12 8 4 2 1 12 - 8 = 4 8 4 2 1 1 4 - 4 = 0 8 4 2 1 1 1 0 0 0 = 0 8 4 2 1 0 0 0 0 so now you have 11000000 take your old table 128 64 32 16 8 4 2 1 1 1 0 0 0 0 0 0 128 + 64 = 192``` Now you know the easy way to convert between these bases. once again the other tutorials I have found show you how to convert to hex by dividing by 16 much more complicated in my opinion. I hope this helps.
 03-05-2009, 01:23 PM #2 Tinkster Moderator   Registered: Apr 2002 Location: in a fallen world Distribution: slackware by choice, others too :} ... android. Posts: 23,067 Blog Entries: 11 Rep: Ummm ... why do you post this in Newbie and not in our tutorial section?
 03-05-2009, 01:45 PM #3 Gortex Member   Registered: Nov 2005 Location: Enid Ok Distribution: ubuntu 64 , debian , fedora core , vista ultimate 64, Winows 7 64 ultimate :p Posts: 219 Original Poster Rep: wasn't paying attention sorry. /shrug Just remove the thread. Last edited by Gortex; 03-05-2009 at 01:48 PM.
 03-05-2009, 02:12 PM #4 H_TeXMeX_H LQ Guru   Registered: Oct 2005 Location: \$RANDOM Distribution: slackware64 Posts: 12,928 Blog Entries: 2 Rep: Ok, but why would you even need to do this by hand ? What I usually do if I ever have to do it by hand is make a table of binary to hex (and of course decimal fits on there too).
 03-05-2009, 02:15 PM #5 sundialsvcs LQ Guru   Registered: Feb 2004 Location: SE Tennessee, USA Distribution: Gentoo, LFS Posts: 7,672 Rep: I keep my HP-16C calculator fresh with batteries for just this purpose ... SISSIES FOR ITS NOT NOTATION POLISH REVERSE (... or something like that...) Last edited by sundialsvcs; 03-05-2009 at 02:16 PM.
03-05-2009, 02:45 PM   #6
Gortex
Member

Registered: Nov 2005
Location: Enid Ok
Distribution: ubuntu 64 , debian , fedora core , vista ultimate 64, Winows 7 64 ultimate :p
Posts: 219

Original Poster
Rep:
Quote:
 Originally Posted by sundialsvcs I keep my HP-16C calculator fresh with batteries for just this purpose ... SISSIES FOR ITS NOT NOTATION POLISH REVERSE (... or something like that...)

can you use that calculator for the CCNA exam ?

Like I said if the information is not useful or in the wrong place just remove it.

03-05-2009, 02:54 PM   #7
Gortex
Member

Registered: Nov 2005
Location: Enid Ok
Distribution: ubuntu 64 , debian , fedora core , vista ultimate 64, Winows 7 64 ultimate :p
Posts: 219

Original Poster
Rep:
Quote:
 Originally Posted by H_TeXMeX_H Ok, but why would you even need to do this by hand ? What I usually do if I ever have to do it by hand is make a table of binary to hex (and of course decimal fits on there too).
if you follow the ccna guide lines on subnetting, this information is very useful. imo

 03-05-2009, 03:29 PM #8 Tinkster Moderator   Registered: Apr 2002 Location: in a fallen world Distribution: slackware by choice, others too :} ... android. Posts: 23,067 Blog Entries: 11 Rep: I find it useful, it's just not a question, and hence in the wrong place. Please submit it as a tutorial in the answers section (maybe after fixing the spelling) ;}. Cheers, Tink Last edited by Tinkster; 03-05-2009 at 03:30 PM.

 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 Off HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post master General 10 12-21-2007 02:03 AM jabka Programming 12 12-16-2006 06:05 PM maldini1010 Programming 6 02-01-2005 04:03 PM acid_kewpie Programming 10 08-20-2003 02:29 PM miguetoo Programming 13 04-24-2003 09:49 PM

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

 Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap -