My Math Forum  

Go Back   My Math Forum > College Math Forum > Calculus

Calculus Calculus Math Forum


Thanks Tree1Thanks
  • 1 Post By Denis
Reply
 
LinkBack Thread Tools Display Modes
April 16th, 2017, 03:19 AM   #1
Newbie
 
Joined: Nov 2016
From: iran

Posts: 4
Thanks: 0

how do I convert binary to hexadecimal?

hi i wanted to know how to convert a binary(base 2) number to hexadecimal (base 16).
i can do it by converting binary to decimal and decimal to hexadecimal but i want to know how i can do this conversion in one step.

let's take 01100001 for example which equals to 97 in decimal and 61 in hexadecimal
(i chose that number because every eight bit is one byte and if you show me how it's done using that number it would be much clearer.
mohsentux is offline  
 
April 16th, 2017, 03:37 AM   #2
Math Team
 
Joined: Oct 2011
From: Ottawa Ontario, Canada

Posts: 9,410
Thanks: 638

https://www.google.ca/?gws_rd=ssl#q=...adecimal&spf=1
Thanks from Joppy
Denis is online now  
April 16th, 2017, 04:23 AM   #3
Math Team
 
Joined: Jan 2015
From: Alabama

Posts: 2,484
Thanks: 628

16 (decimal) is (of course) 10 (hexadecimal) and 10000 (binary). Given any binary number, separate it into groups of 4 "bits" and convert each group to hexadecimal separately. For example, 10000 (binary) would be 1 and 0000. 1 (binary) is 1 (hexadecimal) and 0000 (binary) is 0 (hexadecimal). 10000 (binary) is 10 hexadecimal.

For the numbers you give, 01100001 (binary), separate it to 0110 (binary) and 0001 (binary). 0110 (binary) is 0*8+ 1*4+ 1*2+ 0*1= 6 and 0001 (binary) is 0*8+ 0*4+ 0*2+ 1*1= 1 (obviously) so 01100001 (binary) is 61 (hexadecimal).

Another example: 111001011010 separates as 1110, 0101, and 1010. 1110 is 1*8+ 1*4+ 1*2+ 0*1= 14 (D in hexadecimal), 0101 is 0*8+ 1*4+ 0*2+ 1*1= 5, and 1010 is 1*8+ 0*4+ 1*2+ 0*1= 10 (A in hexadecimal) so 111001011010 (binary) is D5A in hexadecimal.
Country Boy is offline  
April 18th, 2017, 04:53 AM   #4
Math Team
 
Joined: Jan 2015
From: Alabama

Posts: 2,484
Thanks: 628

Quote:
Originally Posted by Country Boy View Post
16 (decimal) is (of course) 10 (hexadecimal) and 10000 (binary). Given any binary number, separate it into groups of 4 "bits" and convert each group to hexadecimal separately. For example, 10000 (binary) would be 1 and 0000. 1 (binary) is 1 (hexadecimal) and 0000 (binary) is 0 (hexadecimal). 10000 (binary) is 10 hexadecimal.

For the numbers you give, 01100001 (binary), separate it to 0110 (binary) and 0001 (binary). 0110 (binary) is 0*8+ 1*4+ 1*2+ 0*1= 6 and 0001 (binary) is 0*8+ 0*4+ 0*2+ 1*1= 1 (obviously) so 01100001 (binary) is 61 (hexadecimal).

Another example: 111001011010 separates as 1110, 0101, and 1010. 1110 is 1*8+ 1*4+ 1*2+ 0*1= 14 (D in hexadecimal), 0101 is 0*8+ 1*4+ 0*2+ 1*1= 5, and 1010 is 1*8+ 0*4+ 1*2+ 0*1= 10 (A in hexadecimal) so 111001011010 (binary) is D5A in hexadecimal.
No, "14" is not "D" in hexadecimal, it is "E" so the final answer here should be "E5A", not "D5A"!
Country Boy is offline  
Reply

  My Math Forum > College Math Forum > Calculus

Tags
binary, convert, hexadecimal



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
hexadecimal algorithm Techmaster Computer Science 7 August 26th, 2014 01:29 PM
Binary to hexadecimal Igo Computer Science 3 September 7th, 2012 03:58 AM
Hexadecimal Notation Primalscientist Computer Science 3 April 17th, 2011 03:31 AM
Convert binary range with fixed number of zeros/ones hans-de-jong Number Theory 2 June 30th, 2009 04:15 PM
I need some help on binary, hexadecimal and decimal numbers! johnny Computer Science 2 October 13th, 2007 02:00 PM





Copyright © 2017 My Math Forum. All rights reserved.