ComputersProgramming

How to convert bytes to megabytes and back?

Today our life is hard to imagine without computers. They are found everywhere. The words "bit", "byte", "megabyte" have firmly entered our life. Often ordinary people use them, not knowing what they mean and how they are connected.

Bits, kilobits ...

There is an old anecdote. What is the difference between a normal person and a computer technician? The first is sure that in one kilobyte 1000 bytes, and the second - that in a kilogram - 1024 grams. And often normal people ask, and what, in fact, is a joke. Well, we'll figure out where the legs grow from and find out how to translate bytes into megabytes or other multiples.

Bit is the smallest unit of measure for binary information. More precisely, its quantity. Here we mean information about one of the two states of the object. For example, there is a signal / no signal, true / false, 1/0, etc. There is a name from the English abbreviation bi nary digi t ("binary number") = bit. Also, one bit of binary code is called a "bit". In this case, the decimal digit is represented as a zero or one, for example as shown in the table. This is called the "binary number system ."

Decimal digit Binary code Decimal digit Binary code
0 0 5 101
1 1 6th 110
2 10 7th 111
3 eleven 8 1000
4 100 9 1001

As you can see, the numbers 0 and 1 have the same representation, while in the decimal two there are already two digits - 10. And in the eight - four (1000).

And what is a kilobit?

The widest application of this number system found in computer technology. In particular, binary numbers are used to number the cells of digital memory.

Let us give an example. The number of all possible addresses on any address bus is equal to the number two to some extent N. Or else - 2 N. Here, N denotes the number of bits of the bus. What do we see? The number of cells in the memory chip is equal to one or another degree of number 2. And then - even more interesting. The number 2 10 = 1024 is very close to 1000. At the same time, one thousand is used as the basis for decimal consoles. Therefore, 1024 bits were called "kilobits". By analogy with a kilogram or kilometer. We recall the anecdote given above.

Bytes and bits

The following is known from computer science. "Byte" (English byte) is called a storage unit, as well as processing of digital information. It is the number of bits that are simultaneously processed by the computer. It's a classic.

Modern computer systems use a byte consisting of 8 bits. Therefore, it can take 256 (2 8 ) different values.

To convert bytes into megabytes, we proceed simply. Arithmetic for the third class: 1 kilobyte = 1024 bytes. Remember about 2 10 ? A 1 MB = 1024 KB (i.e., 2 20 = 2 2x10 ) = 1048576 bytes.

Areas of use

Often, bytes are used in computer systems, and bits are used in information transmission networks. Typically, to measure speed.

Let us give an example. The Ethernet network provides a data transfer rate in the range from 10 Mbps to 1 Gb / s. Still need to clarify that, as a rule, the byte is denoted by the letter "B" (or Latin "B"). "Bit" and recorded. The prefix "kilo" is indicated by the letter "K". It is uppercase, but not lowercase. A small "k" is written down the name of the decimal consoles "kilo"; 10 3 = 1000. Now consider in more detail the following question.

Binary and decimal consoles

How to translate bytes into megabytes is more or less clear. In early 1999, a well-known organization IEC (International Electrotechnical Commission) put into circulation binary consoles for the formation of multiple units of information. The reason for this was the proximity of the numbers 1024 and 1000. Similar to the standard decimal consoles used by the international SI system, binary ones differ only by replacing the last syllable by "bi" (from the Latin binarius - binary). It looks like it's shown in the table below.

Console Abbreviations,
Adopted by IEC,
Bytes / bits
The relevant
Decimal
console
The amount by which
The initial
Amount of information
Kibi KiB (KiB) / Kibit Kilo (10 3 ) 1024 or 2 10
Meby MiB (MiB) / Mibit Mega (10 6 ) 1048576 or 2 20
Gibi GIB (GiB) / Gibit Giga (10 9 ) 1073741824 or 2 30
Teby TiB (TiB) / Tibit Tera (10 12 ) 1099511627776 or 2 40
Peebee PiB (PiB) / Pibit Peta (10 15 ) 1125899906842624 or 2 50
Exbi EiB (EiB) / Eibit Exa (10 18 ) 1152921504606846976 or 2 60
Zebras ZiB / Zybite Zetta (10 21 ) 1180591620717411303424 or 2 70
Yobi YiB (YiB) / Yibit Jotta (10 24 ) 1208925819614629174706176 or 2 80

This standard was approved by many countries, but the introduced names are not used so often, mostly in written speech, and in oral - almost never. As they say, because of cacophony. Maybe you are right. Agree that a kilobit sounds more pleasant than a kibibit, and a megabyte is better than a mebibyte.

The transfer of bytes to megabytes is clear. But that's not all. So far, there are two approaches to the formation of multiple quantities of information. What is even more confusing is the question of how many in 1 megabyte bytes.

The first approach

In it, the prefixes "kilo", "mega-", etc. are used as binary for the following cases:

  • In file managers and other software with reduced file size. For example, the program reports that the size of the audio is 10 MB. By the classical method of translating bytes into megabytes, we consider the size, which is equal to 10485760 bytes. In the file managers of the latest developments, there is a standard indication of the size - using a shortened form of binary consoles, for example MiB (MiB).
  • Manufacturers of RAMs, flash cards, video memory.
  • The volume of the CD-ROM is specified only in binary megabytes.

The second approach

Here, the prefixes are used as decimal in the following cases:

  • Hard and optical drives. Their volume is given in decimal megabytes. Exception: A CD whose capacity is specified in binary.
  • Informal communication. In this case, the values are roughly rounded. So, for example, about a file with a volume of 10 million bytes can say that it "weighs" 10 megabytes. What do we see here? In this case, the bytes in megabytes were not translated correctly, but this happens when they communicate.
  • The designation of the speeds of telecommunication connections. For example, take the standard 100BASE-TX. In it, 100 Mbit / s corresponds to a data transfer rate of exactly 100 million bps. Let's look at a more "smart" connection with a speed of 10 Gbps (standard 10GBASE-X). It corresponds exactly to 10 billion bps. Here so. And not a bit more or less.

But with three-inch diskettes at 1.44 MB (remember these?) Was even more interesting. Their capacity was specified in binary-decimal megabytes. This was obtained as follows. One such "megabyte" was equal to 1000 KB, which is about 0.977 MiB, but at the same time, 1 KB was 1024 bytes.

It should be noted that there is a difference between these two options for representing consoles. And if in the case of kilobytes it does not exceed 2.4%, then for megabytes it is already 4.9%, for gigabytes - 7.4%, and for terabytes - almost 10%. Naturally, not in favor of the binary representation. That is, the producers "steal" the manufacturers bytes. For example, you buy a hard disk with a capacity of 1 TB. As a person who has studied computer science, you are firmly convinced that there are 1099511627776 bytes in it. And it turns out - "only" 1000000000000. That is, you have "bitten off" more than 99.5 billion bytes (almost 98 GB). Is this a lot or a little? Roughly - from 40 to 200 feature films, depending on the format. About what does not speak? That is, as written above, the tenth.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.birmiss.com. Theme powered by WordPress.