Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hexadecimal To Decimal 1

Status
Not open for further replies.

ElijahBaley

IS-IT--Management
May 4, 2001
1,598
GB

Hi

Just wondered how to work with Hex, I can't quite see the pattern yet - how is it that 99 in hex = 153 decimal, if I can do this then the binary conversion will not a problem.

Thanks for any help

EB
 
Actually I think you will find hex to binary or binary to hex conversion quite easy. One hex digit is 4 binary bits.
thus 99 = 1001 1001

The first thing to is recognize your base and its weighted value.

Note: Anything to the 0 power equals 1 and anything to the 1 power is itself.

For example in decimal you have a base of 10. The least significant position is 10 to the power of 0, the next position is 10 to the power of 1, the next position is 10 to the power of 2, and so on with the powers incrementing by 1.

99ten = ( 9 * 10 to the 1st power) + ( 9 * 10 to the 0 power )
= ( 9 * 10 ) + ( 9 * 1 )
= 90 + 9



Hex you have a base of 16. The least significant position is 16 to the power of 0, the next position is 16 to the power of 1, the next position is 16 to the power of 2, and so on with the powers incrementing by 1.

99H = ( 9 * 16 to the 1st power) + ( 9 * 16 to the 0 power )
= ( 9 * 16 ) + ( 9 * 1 )
= 144 + 9
= 153


Binary you have a base of 2. The least significant position is 2 to the power of 0, the next position is 2 to the power of 1, the next position is 2 to the power of 2, and so on with the powers incrementing by 1.

1001 = ( 1 * 2 to the 3rd power ) + (0 * 2 to the 2nd power) + (0 * 2 to the 1st power) + (1 * 2 to the 0 power)

= ( 1 * 8 ) + 0 + 0 + ( 1 * 1 )
= 8 + 1
= 9




 
Hmm, I see what you are getting at, but what about a formula to convert one to the other?

Thanks for your response
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top