Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Hexadecimal convertions

Coolman

Posted 31 August 2006 - 08:48 PM

Hey can someone please tell me a easy way of converting decimal number to hexadecimal numbers and vice versa, thanks biggrin.gif

Dave

Posted 31 August 2006 - 10:29 PM

same method as going from decimal to binary but instead of dividing by 2 you divide by 16

Coolman

Posted 31 August 2006 - 10:34 PM

QUOTE(Dave @ Aug 31 2006, 11:29 PM) View Post

same method as going from decimal to binary but instead of dividing by 2 you divide by 16


yeah I figured it out before you posted, but thanks anyway biggrin.gif

John

Posted 01 September 2006 - 07:31 AM

You do not need to know this for the higher.

Dave

Posted 01 September 2006 - 03:03 PM

but you will john in a few weeks time tongue.gif

John

Posted 01 September 2006 - 10:53 PM

QUOTE(Dave @ Sep 1 2006, 04:03 PM) View Post

but you will john in a few weeks time tongue.gif


I can do it already though, the easiest way in my opinion is to convert to binary then hex

Dave

Posted 02 September 2006 - 05:33 PM

maybe but the problem with doing that is you are doing extra conversions by hand which, with me anyway, tends to lead to more errors

John

Posted 02 September 2006 - 05:36 PM

fair enough, i'm just too lazy to divide by 16 when i dont have a calulator

sparky

Posted 05 September 2006 - 02:29 PM

Ok the definitive guide to converting Hexadecimal numbers!

What you need to remember is that hexadecimal uses the following :-
0 1 2 3 4 5 6 7 8 9 A(for 10) B(for 11) C(for 12) D(for 13) E(for 14) F(for 15).


Example 1


Convert HEX A90B into it's binary equivalent

Ok, break the number into the four parts A, 9, 0 and B.

Write down the 4 bit binary for these digits - A is 1010 (Since this represents 10), 9 is 1001, 0 is 0000, and B (Since this represents 11) is 1011.

The number A90B (hex) is then 1010 1001 0000 1011 (base 2/ binary).

Example 2

Convert Hex A13B into decimal

This is really quite simple, all you do is :-

(10)(16 x 16 x 16) + (1)(16 x 16) + (3)(16) + (11)(1)
= 41275 (Decimal)

Example 3

Convert 41275 into HEX.

41275 / 16 = 2579 r 11 (B in hex)
2579/16 = 161 r 3
161/16 = 10 r 1
10/16 = 0 r 10 (A in hex)

Then simply read the remainders up the way and you get A13B, which is the number in HEX.


Incase anyone else is wanting to know the wonders of converting Hex! rolleyes.gif

  • You cannot start a new topic
  • You cannot reply to this topic