What is Data? It's types and measuring units

What is data? How is numeric data be represented in computer memory, it's form, and measuring units.

A photo of Betizazu Alemu looking professional.
Betizazu Alemu
  • 6 min read

This article is the first of four articles wrapped under a mini-series called Data represenation in a Computer Memory.

In one of my previous articles, when I tried to define what programming means ( you can find it here ), I talked about computers and what they do. I also talked a little about how they represent numerical values. This article will elaborate more and make you understand what data is, how we measure it, and how we represent numbers in computer memory. So, without further ado, let’s get into it.

What is Data?

Data is nothing but some value that can be recorded in digital form. Data can be as simple as our names or ages. It can also be as complicated as graphs, charts, and maps. Simply put, Data is a symbolic representation of something in the real world on to computer’s memory.

Data Types

The above definition clearly shows us that there are different forms of data. What I mean by that is, we don’t represent names and numbers in the same format, right? They both have other representational structures. Names use alphabetic characters like A - Z or a - z, while ages use numerical symbols usually using the combination of 0 - 9. Like wise, computers also have a different form of representation called Data Type that will answer its form. It will answer the questions like, is it a number or a string or some other format?

Now, the thing what I don’t want you to get confused about is that different programming languages use various forms of data types. For example, in C++, the number 2 is represented as an integer. In contrast, 2.0 is described as a floating-point number. Still, they both fall into the same category called number when it comes to Python or JavaScript. One thing to note here is that, in computers, the actual representation of data remains as numbers, which means in a binary number representation; What really differentiates the form of Data is how much memory size we need to store that specific value. Let’s talk about how we measure data in computers to understand this.

Data measurement in computers

As we discussed in one of our previous article , everything in the computer is 0s and 1s; We also saw an example representing a decimal number 8 as 111. So, to measure and store data in a computer, the 0s and 1s are our basis. I mean that 1 single position in a string of 0s and 1s is called Bit. To store a decimal number 8, we need 3 positions meaning 3 Bits, that is 111. In this case, we say our Computer has a memory size of 3 (in the ideal world). Simple, right?

The question is, how many bit positions we need to store more significant numbers like thousands or even higher? If we need 3 strings of 0s and 1s to represent just a number 8, imagine how long it will be to represent a higher number. That’s where we will come to Bytes (described as B). Bytes are the basic measurements of data in the computer or computer memory size. Byte means simply 8 positions of the 0s and 1. Hence, we need 0.375 Bytes to store the number 8 in computer.

Suppose a value is more extensive than 1 Byte (i.e., 8 positions); we move on to the next one, that is Kilo Bytes (KB). 1 Kilo Byte means 1024 Bytes strung together (if you would like to calculate it in terms of bits, it will be 1024 * 8 Bits). Then we will advance to Mega Bytes (MB), then Giga Bytes (GB), then Tera Bytes (TB), then Peta Bytes (PB), then Exa Bytes (EB), then Zetta Byte (ZB), then Yotta Byte (YB).

When we casually say “My computer/phone/tablet has 64/256/512 GB or even 1 Tera Byte memory”, we are talking about how many string of bits our device can hadle.

To make things clear, take a look at the following table.

Unit NameValue
Bit Either 0 or 1
Byte (B) 8 bits
Kilobyte (KB) 1,024 B or 8,192 Bits
Megabyte (MB) 1,024 KB or 1,048,576 B
Gigabyte (GB) 1,024 MB or 1,073,741,824 B
Terabyte (TB) 1,024 GB or 1,099,511,627,776 B
Petabyte (PB) 1,024 TB or 1,125,899,906,842,624 B
Exabyte (EB) 1,024 PB or 1,152,921,504,606,846,976 B
Zetta Byte (ZB) 1,024 EB or 1,180,591,620,717,411,303,424 B
Yotta Byte (YB) 1,024 ZB or 1,208,925,819,614,629,174,706,176 B

Let’s assume our computer has 516 GB of memory; what will it be in KB, MB, and TB? Well, we just have to do the Maths. Let’s start from the higher one and work our way down to the smallest one:

516 GB = (516 / 1024) TB = 0.504 TB
516 GB = (516 * 1024) MB = 528,384 MB
516 GB = (516 * 1024 * 1024) KB = 541,065,216 KB

note

To get the value on TB we divided but for the other we multiplied, the reason is Tera Byte is bigger than Giga Byte.

By now, I think you understand why we mention the size of a storage media (which we will talk about after this serious has ended) when we consider buying one. The higher it is, the more data we can store on it.

The trickiest part is this, how do we represent real-world value in a computer? Data cannot be entered and processed directly into computers using human language since computers only speak the binary language. To answer this, let’s see how we represent numbers in computers here, and we move on to the other forms of data in the upcoming articles.

Number representation

Let’s take an example of how much size we need to store a number 679. As discussed in the previous article the equevalent binary value of 679 in decimal is 1010100111. That means, we need 10 positions. Since Bytes are our primary memory measuring unit, the number 679 requires 2 Byte (16 Bits) memory size.

Why 16 when we actually need 10? The simplest reason is, we use whole numbers to measure Computer memory size. Thus, when we divide 10 by 8 (to convert it to Bytes) we get a fractional value of 1.25 which isn’t a value we use to measure data in computers so we round it up. Then the actual value that you get on the computer memory will be 0000001010100111 rather than 1010100111. If you ask me why, I say, adding zeros infront will not have any difference on the value.

How about representing 102,436,895,731,945, then?

(102,436,895,731,945)10 = (10111010010101001110010110010000011000011101001)2

Right? (If you don’t believe me, convert it using the methods we discussed in this article ). This means we need 47-bit positions. To convert to Bytes, we have to divide it by 8, which gives us 5.875. Since we don’t have the so-called 5.875, we will upgrade it to the closest higher integer number 6. So we need 6 Bytes. That’s how we represent positive integer numbers in computer memory.

What about negative and floating point representations? We will not cover them in this article since the concept itself requires the whole article (I will definitely right an article about it later on), and we don’t need them unless we want to design circuits. Knowing the basics is enough for our programming journey. Still, if you wish to extend your knowledge, you can read more about it in this great article .

The following article will talk about how we represent texts on computers.

Discover related blog posts that delve into similar themes, share valuable insights, and offer fresh perspectives.