Jump to content

Binary, Decimal, Hex, the Manual way!!

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
22 replies to this topic

#1
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
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:-


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)
Posted Image
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

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


 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:-


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
Posted Image
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
xtraze

xtraze

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 910 posts
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!.

#3
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts

xtraze said:

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

#4
xtraze

xtraze

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 910 posts
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.

#5
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts

xtraze said:

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?

#6
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
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

#7
AfTriX

AfTriX

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 586 posts
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.

#8
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Umm I like to make things manual as that would increase my knowledge!

#9
AfTriX

AfTriX

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 586 posts

Tcm9669 said:

Umm I like to make things manual as that would increase my knowledge!

Oh then you must be a big headed huh??? LOL..:D

#10
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Most calculators won't do ternary.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#11
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts

SPORTING said:

It Is Hard To Undersatand
Yes I know, hard to explain too!

AfTriX said:

Oh then you must be a big headed huh??? LOL..:D

Nope I'm not ;), I'm normal headed, Big headed doesn't make you intelligent, You brain does, I know big headed people that are the dumbest and most stupid people I ever knew! and when I say knowledge I don't mean general knowledge, but I mean knowledge about PC's because I like to know how things work, and I like to go in detail, in the IT world, other things doesn't actually interest me...

#12
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts

WingedPanther said:

You can use that process for any base. Babylonians used base 60. Mayans used a variation on base 20.

WingedPanther said:

Most calculators won't do ternary.

Can you explain me a little more, what these actually are? Thanks