pctechguide.com

  • Home
  • Guides
  • Tutorials
  • Articles
  • Reviews
  • Glossary
  • Contact

Number Systems 3

The basic unit of computer storage is the eight bit byte, which can store values in the decimal range 0 to 255. The problem when dealing with numbers in binary format is that they quickly become very long. For instance, the number 317 is represented as: 0b100111101, which is bad enough, but the number 17341 is no less than 0b100001110111101!

This is clearly going to be a headache, but there is another number system that comes to our rescue: hexadecimal. Hexadecimal (or hex) is a base 16 number system, so now our number columns increase in powers of 16. Now lets take the number 17341 expressed as a hex number:

4096 256 16 units
4 3 B D

Here, where decimal uses 5 digits, and binary uses 15 digits (bits), hex uses only 4 digits: 0x43BD. (Notice that the number is preceded with 0x, identifying it as a hex number in the same way that preceding a number 0b denotes a binary number.) Of course what’s confusing here is the use of the B and the D – how can these be part of a number? Well, remember that this is a base 16 number system, and we usually only use numbers 0 to 9. So, the numbers 10 to 15 in decimal need to be represented in hex using characters from the alphabet, A through to F.

The following table shows the values 0 to 15 in decimal, binary, and hexadecimal.

Decimal Binary Hex
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

How Does Hexadecimal Help?

So, you may think that’s all very well, but how does using hexadecimal help us to work with binary numbers? Well, two things. First, take a look at the representation of 87 again:

128 64 32 16 8 4 2 units
0 1 0 1 0 1 1 1

Notice that the one hundred and twenty-eights column has been included despite it being of value 0. This is the way that the computer stores numbers in RAM, because every number stored will take at least one byte. Now, also look at the table above showing the hex count 0 to F, and compare the binary column. Notice that each hex number is represented by four binary digits? And there’s the key. We can split each byte into two groups of four bits, and equate them to hex values.

binary 128 64 32 16 8 4 2 units
0 1 0 1 0 1 1 1
hex 16 units
5 7

So, what we’re saying here is that 87 = 0b01010111 = 0x57. The key here is that the 8 bit binary number has been split into two groups of 4 bits, and equated to the hexadecimal numbers. So, the first four bits: 0b0101=0x5, and the second four bits: 0b0111=0x7. And that’s really it – very quickly and simply, we have converted the binary to hex.

It’s simple to check by converting to decimal: we have five sixteens, and seven units. So, 5×16=80, and 80+7=87. Correct!

And there you have it. Because the hex number system so readily provides a shorthand for the byte, requiring only two characters to represent the bytes possible values, it is widely adopted for all sorts of computer purposes.

The simple fact is, anyone approaching computer science in pretty much any discipline will need to get themselves familiar with counting in base 16. But the good news is, with only a bit of practice it quickly becomes second nature, and on the next page you can test yourself, and get in some practice, with an interactive conversion tool. Or, you can just use it to convert numbers for you

  • Number Systems 2
  • Number Systems 3
  • Number Systems 4

Filed Under: Number Systems

Latest Articles

Object Oriented Programming 6

Now that we know what a class is, and how to derive classes using inheritance, we'll take a quick look at the slightly thorny issue of multiple inheritance. In the simplest terms, this is when a derived class has more than one base class. Theoretically a class may derive from any number of base … [Read More...]

Handheld Evolution

Psion's success prompted other companies to start looking at the PDA market. Notable amongst these was Apple Computer, whose launch of its first Newton MessagePad device in mid-1993 was heralded as a major milestone of the information age. Apple was soon joined by several other handheld … [Read More...]

IEEE 802.11 – The new standard

The Institute of Electrical and Electronics Engineers (IEEE) ratified the original 802.11 specification in 1997 as the standard for WLANs. That version of 802.11 provided for 1 Mbit/s and 2 Mbit/s data rates and a set of fundamental signalling … [Read More...]

Revolutionize Your Internet Experience with Orbi 960 – The Ultimate WiFi System

In a world where seamless connectivity is essential, slow and unreliable internet connections are a major problem. Whether you are running a business, … [Read More...]

Do You Need a VPN When Trading Cryptocurrency?

There’s no doubt that the biggest global industries in 2023 are tech-driven, while there remains a significant crossover between many of these … [Read More...]

Goodbye Bitcoin: the 3 alternative cryptocurrencies that have great upside potential, according to experts

Bitcoin has been a very lucrative investment for people that got into it early. One report from The Motley Fool pointed out that $10 of bitcoin … [Read More...]

Self-driving cars face their Achilles’ heel and may be targets of hackers

The market for self-driving cars is booming. Customers spent $22.22 billion on these autonomous vehicles in 2021 and they will likely spend more in … [Read More...]

How to avoid scams with bitcoin and other cryptocurrencies

Cryptocurrencies got a bad reputation when scams multiplied like ants on a piece of cake. Even today many people associate bitcoin and other … [Read More...]

WHAT IS CLOUD COMPUTING AND WHAT ARE ITS MAIN BENEFITS?

Users are Increasingly using cloud computing to store their information, which is replacing local storage. The business digitization process goes … [Read More...]

Guides

  • Computer Communications
  • Mobile Computing
  • PC Components
  • PC Data Storage
  • PC Input-Output
  • PC Multimedia
  • Processors (CPUs)

Recent Posts

Major Vulnerability Exposed in WhatsApp

WhatsApp is the latest application to fall prey to a major vulnerability being exposed. This impacted users of the web-based app and not the mobile … [Read More...]

AI-Driven Software Improves Trading Strategies for Investors

Artificial intelligence technology is changing the state of modern finance. A growing number of investors are utilizing AI to improve the … [Read More...]

Can Alexa Help Your Business To Become A Top Player On The Web?

Alexa Internet Inc. was founded in 1996 by Brewster Kahle and Bruce  Gilliat as an independent company and acquired by Amazon.com in 1999. Now simply … [Read More...]

[footer_backtotop]

Copyright © 2023 About | Privacy | Contact Information | Wrtie For Us | Disclaimer | Copyright License | Authors