Warning: Illegal string offset 'html' in /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php on line 909

Warning: Cannot modify header information - headers already sent by (output started at /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php:909) in /home/hsn/public_html/forum/admin/sources/classes/output/formats/html/htmlOutput.php on line 114

Warning: Cannot modify header information - headers already sent by (output started at /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php:909) in /home/hsn/public_html/forum/admin/sources/classes/output/formats/html/htmlOutput.php on line 127

Warning: Cannot modify header information - headers already sent by (output started at /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php:909) in /home/hsn/public_html/forum/admin/sources/classes/output/formats/html/htmlOutput.php on line 136

Warning: Cannot modify header information - headers already sent by (output started at /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php:909) in /home/hsn/public_html/forum/admin/sources/classes/output/formats/html/htmlOutput.php on line 137

Warning: Cannot modify header information - headers already sent by (output started at /home/hsn/public_html/forum/cache/skin_cache/cacheid_1/skin_topic.php:909) in /home/hsn/public_html/forum/admin/sources/classes/output/formats/html/htmlOutput.php on line 141
Hexadecimal convertions - HSN forum

Jump to content


Hexadecimal convertions


8 replies to this topic

#1 Coolman

    Newbie

  • Members
  • Pip
  • 7 posts
  • Location:Glasgow

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

#2 Dave

    Ruler (but not owner) of hsn

  • Moderators
  • PipPipPipPipPipPipPipPip
  • 4,252 posts
  • Location:kilmarnock(ok kilmaurs)
  • Interests:programming, exercising, brass band, using this board
  • Gender:Male

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

If i am not here i am somewhere else



#3 Coolman

    Newbie

  • Members
  • Pip
  • 7 posts
  • Location:Glasgow

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

#4 John

    HSN Legend

  • Members
  • PipPipPipPipPipPipPipPip
  • 2,713 posts
  • Location:In a Peripheral Estate in Glasgow
  • Interests:First the boring stuff:<br /><br />2004 Results:<br /><br />Highers:<br /><br />Computing A<br />Craft and Design A<br />Physics A<br />Administration A<br />English A<br />Maths A<br />Modern Studies A<br />French A<br /><br />2005 Results:<br /><br />Advanced Highers:<br />Computing A<br />Physics A<br />Maths A<br />Modern Studies A<br />English A<br /><br />2006 Results:<br /><br />Advanced Highers(All Crashed):<br />Chemistry A<br />Biology A<br />Business Managemnt A<br /><br />Aren't I marvellous?
  • Gender:Male

Posted 01 September 2006 - 07:31 AM

You do not need to know this for the higher.

#5 Dave

    Ruler (but not owner) of hsn

  • Moderators
  • PipPipPipPipPipPipPipPip
  • 4,252 posts
  • Location:kilmarnock(ok kilmaurs)
  • Interests:programming, exercising, brass band, using this board
  • Gender:Male

Posted 01 September 2006 - 03:03 PM

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

If i am not here i am somewhere else



#6 John

    HSN Legend

  • Members
  • PipPipPipPipPipPipPipPip
  • 2,713 posts
  • Location:In a Peripheral Estate in Glasgow
  • Interests:First the boring stuff:<br /><br />2004 Results:<br /><br />Highers:<br /><br />Computing A<br />Craft and Design A<br />Physics A<br />Administration A<br />English A<br />Maths A<br />Modern Studies A<br />French A<br /><br />2005 Results:<br /><br />Advanced Highers:<br />Computing A<br />Physics A<br />Maths A<br />Modern Studies A<br />English A<br /><br />2006 Results:<br /><br />Advanced Highers(All Crashed):<br />Chemistry A<br />Biology A<br />Business Managemnt A<br /><br />Aren't I marvellous?
  • Gender:Male

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

#7 Dave

    Ruler (but not owner) of hsn

  • Moderators
  • PipPipPipPipPipPipPipPip
  • 4,252 posts
  • Location:kilmarnock(ok kilmaurs)
  • Interests:programming, exercising, brass band, using this board
  • Gender:Male

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

If i am not here i am somewhere else



#8 John

    HSN Legend

  • Members
  • PipPipPipPipPipPipPipPip
  • 2,713 posts
  • Location:In a Peripheral Estate in Glasgow
  • Interests:First the boring stuff:<br /><br />2004 Results:<br /><br />Highers:<br /><br />Computing A<br />Craft and Design A<br />Physics A<br />Administration A<br />English A<br />Maths A<br />Modern Studies A<br />French A<br /><br />2005 Results:<br /><br />Advanced Highers:<br />Computing A<br />Physics A<br />Maths A<br />Modern Studies A<br />English A<br /><br />2006 Results:<br /><br />Advanced Highers(All Crashed):<br />Chemistry A<br />Biology A<br />Business Managemnt A<br /><br />Aren't I marvellous?
  • Gender:Male

Posted 02 September 2006 - 05:36 PM

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

#9 sparky

    Fully Fledged Genius

  • Moderators
  • PipPipPipPipPipPipPip
  • 1,323 posts
  • Location:Airdrie

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
Mark





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users