My Math Forum Binary to hexadecimal

 Computer Science Computer Science Forum

 March 21st, 2012, 08:25 PM #1 Newbie   Joined: Jan 2012 Posts: 15 Thanks: 0 Binary to hexadecimal I know that 1011110000000011 will be BC03 but how do you solve when there are less or more numbers? for example: 1111000011 and 1110110000110 thanks
March 21st, 2012, 08:46 PM   #2
Member

Joined: Jul 2010

Posts: 83
Thanks: 2

Quote:
 Originally Posted by Igo I know that 1011110000000011 will be BC03 but how do you solve when there are less or more numbers? for example: 1111000011 and 1110110000110 thanks
Basically, one hex digit corresponds to 4 binary digits (a "nibble"), so we can simply extract each successive group of binary digits and map them directly to hex (since they're relatively "friendly" bases). For example, you could just repeatedly perform a logical-and with 0xf and then shift right 4 places until the value reaches zero. A lookup table might be useful, too.

March 21st, 2012, 08:52 PM   #3
Global Moderator

Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms

Quote:
 Originally Posted by Igo but how do you solve when there are less or more numbers?
You can add as many 0s as you need on the left. Just like 23 = 023 in decimal, 1110110000110 = 0001110110000110 in binary.

 September 7th, 2012, 03:58 AM #4 Newbie   Joined: Sep 2012 Posts: 7 Thanks: 0 Re: Binary to hexadecimal Binary to Hex In the previous screens you converted a Hexadecimal number to Binary by expressing each Hex place as a Binary "quartet" (ie 4-bits). The process of converting from Binary to Hex uses the same 'quartet' approach, but in reverse. Example 1. Consider Binary: 1000100100110111 (a 16-bit Byte) STEP 1 Break the Byte into 'quartets' - 1000 1001 0011 0111 STEP 2 Use the table above to covert each quartet to its Hex equivalent - 8937 Therefore ... 1000100100110111 = 8937Hex

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post eChung00 Computer Science 3 March 4th, 2013 02:59 PM sciencexboy Number Theory 3 October 1st, 2011 08:32 AM Primalscientist Computer Science 13 April 20th, 2011 12:41 PM Primalscientist Computer Science 3 April 17th, 2011 03:31 AM johnny Computer Science 2 October 13th, 2007 02:00 PM

 Contact - Home - Forums - Cryptocurrency Forum - Top