hexadecimal converting back into decimal

My book says the hexadecimal notation FFFF equals 65535 in decimal value. As I understand it that equals to 2^16. There are a couple of things I still don't fully understand. 1) Is FFFF a mix of both hexadecimal and decimal notation? How does FFFF equals 2^16? I don't understand how to interpret FFFF.

The right most F represents 8 4 2 1, the second most F represents 128 64 32 16, the third most F represents 2048 1024 512 256 the the left most F represents 32768 16834 8192 4096? Is that the correct way of thinking about FFFF? I'm not sure how FFFF equals 65535. I'm sorta lost I don't understand why FFFF equals 65535. Am i thinking about it correctly or am I way off?

1

3 Answers

To begin with, FFFF does not represent 2^16, but rather 2^16 - 1 (it would not be possible for any power of two to be an odd number).

Much like the decimal digits represent quantities of increasing powers of 10, hex digits represent quantities of increasing powers of 16 (in each case, the number whose powers we are dealing in is called the base of the system). Let's break down and reconstruct decimal 65535:

6 5 5 3 5 /--> input is decimal: increasing powers of 10 | | | | | | | | | | \---> 5 * 10^0 = 5 * 1 = 5 | | | \------> 3 * 10^1 = 3 * 10 = 30 | | \---------> 5 * 10^2 = 5 * 100 = 500 | \------------> 5 * 10^3 = 5 * 1000 = 5000 \---------------> 6 * 10^4 = 6 * 10000 = 60000 ======= 65535 

The same with hex FFFF:

F F F F /--> input is hex: increasing powers of 16 | | | | | | | | \------> 15 * 16^0 = 15 * 1 = 15 | | \---------> 15 * 16^1 = 15 * 16 = 240 | \------------> 15 * 16^2 = 15 * 256 = 3840 \---------------> 15 * 16^3 = 15 * 4096 = 61440 ======= 65535 
4

F is 15 in hexadecimal. So,

FFFF = 15*16^3 + 15*16^2 + 15*16^1 + 15*16^0 = 65535 

You can check your correct interpretation step by step with bc on any Unix platform.

Type:

bc ibase=16 F 15 F0 240 F00 3840 F000 61440 F000+F00+F0+F 65535 ibase=A 2^16 - 1 65535 

^ ctlD

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like