Bytes-Basic knowledge

Source: Internet
Author: User

The byte (byte/bait/n. [C]) is a unit of measurement of computer information technology used to measure storage capacity, and also represents data types and language characters in some computer programming languages.
Chinese name
Bytes
Foreign names
Byte
Shorthand
B
Related concepts
IB; bit (b,bit)
Directory
    1. 1  conversion
    2. < Span class= "index" >?  character and byte
    3. different order of magnitude
    4. ?  storage type
    5. 2  related units
    6. ? b with bit
    1. ? B and IB
    2. 3 data Types
    3. 4 language characters
    4. 5 analysis of the concept of easy mixing
    5. ? Word
    1. ? Word length
    2. ? bytes
    3. ? string
    4. ? Character Set
    5. ? Unicode
Conversioncharacters and bytesASCII: An English letter (not case) occupies a byte of space, a Chinese character occupies two bytes of space. A binary number sequence, which is used as a digital unit in a computer, typically a 8-bit binary number, converted to decimal. The minimum value is 0, and the maximum value is 255. such as an ASCII code is a byte. UTF-8 encoding: An English character equals one byte, and one Chinese (with traditional) equals three bytes. Unicode encoding: One English equals two bytes, and one Chinese (with traditional) equals two bytes. Symbol: English punctuation occupies one byte, Chinese punctuation is two bytes. Example: "." 1 bytes in size, Chinese period ". "Takes up 2 bytes in size.between different orders of magnitudeData storage is represented in 10 binary, data transmission is expressed in 2 binary, so 1KB is not equal to 1000B. 1kb=1024b;1mb=1024kb=1024x1024b. where 1024=210. 1B (Byte, byte) = 8 bit (see below); 1KB (Kibibyte, Kbytes) =1024b= 2^10 b;1mb (Mebibyte, MBytes, million-byte, abbreviation "Mega") =1024kb= 2^20 B;1GB (Gigabyte, gigabyte , 1 billion bytes, also known as "gigabit") =1024mb= 2^30 B;1TB (Terabyte, trillion bytes, MBytes) =1024gb= 2^40 b;1pb (petabyte, petabyte bytes, Pat bytes) =1024tb= 2^50 B ; 1EB (Exabyte, exascale bytes, ai bytes) =1024pb= 2^60 b;1zb (zettabyte, 10 trillion bytes, ze bytes) = 1024eb= 2^70 b;1yb (yottabyte, 100 million Bytes, Yao bytes) = 1024zb= 2 ^80 B;1BB (brontobyte, 100 billion bytes) = 1024yb= 2^90 b;1nb (nonabyte, 100 trillion bytes) = 1024x768 BB = 2^100 b;1db (doggabyte, 1 billion bytes) = 1024x768 NB = 2^110 B;[1]Storage TypeThe following is an example of Visual Basic that explains the bytes of various data types.
Data type Storage space size (in bytes) Range
Byte (byte type) 1 0-255
Boolean (Boolean/logical type) 2 True or False
Integer (integral type) 2 -32,768 ~ 32767
Long (length shaping) 4 -2,147,483,648 ~ 2,147,483,647
Single (one-precision floating-point type) 4 Negative range: -3.402823E38 ~ -1.401298E-45 Positive Range: 1.401298E-45 ~ 3.402823E38
Double (dual-precision floating-point type) 8 Negative range: -1.797,693,134,862,32e308 ~-4.940,656,458,412,47e-324 positive range: 4.940,656,458,412,47e-324 ~ 1.797,693,134,862,32e308
Currency (variable ratio shaping/currency type) 8 -922,337,203,685,477.5808 ~922,337,203,685,477.5807
Decimals (decimal type) 14 When there is no decimal point: +/-79,228,162,514,264,337,593,543,950,335 has a decimal point: +/-7.922,816,251,426,433,759,354,395,033,5 the smallest non-0 value: +/- 0.000,000,000,000,000,000,000,000,000,1
Date (time date type) 8 100 year January 1 ~ December 31, 9999
Object (Type) 4 Any Object reference
String (variable length) 10 Length from 0 to about 2 billion
String (fixed length) 10 Length from 1 to about 65,400
Variant (number) 16 Any numeric value, up to a range of Double
Variant (character) 22 With string length, variable length string has the same range
User-defined variables - -
  
An array of any data type requires 20 bytes of memory space, plus 4 bytes per array dimension, plus the space occupied by the data itself. The amount of memory occupied by the data can be calculated by multiplying the number of data elements by the size of each element. For example, the data in a one-dimensional array consisting of 4 2-byte Integer elements, accounting for 8 bytes. These 8 bytes add an additional 24 bytes, making the total memory space required for this array to be 32 bytes. A Variant that contains an array requires 12 more bytes than a single array. [2]Related unitsb and BitThe data store is in "byte" (byte) units, the data transfer is based mostly on "bit" (bit, aka "bit") units, a bit represents a 0 or 1 (i.e. binary), every 8 bits (bit, abbreviated to B) constitute a byte (byte, abbreviated to B), is the smallest level of information units.B and IB1KB (Kibibyte) =1024byte1kib (kilobyte) =1000BYTE1MB (mebibyte) =1048576byte1mib (megabyte) =1000000byte HDD manufacturer is in GIB (decimal , that is, 10 of 3 square = 1000, such as 1MIB=1000KB), while the computer (operating system) is in GB (2, that is, 2 10, such as 1MB=1024KB) calculated, but the domestic user generally understood as 1mib=1m=1024 KB, Therefore, in order to facilitate the understanding of Chinese culture, the translation MiB is MB is also possible. Also according to the hard disk manufacturers and users of the 1MB size of different understanding, so a lot of 160G hard disk actual capacity according to the actual computer 1mb=1024kb count is less than 160G, this can also explain why the new hard drive "short weight" and not as large as it is labeled. Note: 10TB is approximately equal to the storage capacity of a human brain. [3]Data TypeThe Byte data type (byte type) is stored in a byte (byte) and can be distinguished by 256 digits, with a range of values ranging from 0 to 255. Byte is an unsigned type from 0-255, so it cannot represent a negative number. The specific reference data type.language charactersThe effect is equivalent to the unsigned char typedef unsigned char byte defines a new type of byte, which is actually unsigned char in VC + +, The definition of byte data is contained in the WINDOWS.H header file, calling byte to add code # include <windows.h> in Java, A byte is a keyword that declares that an shaping constant occupies a byte in the content range is -128~127analysis of the concept of easy mixingWordIn a computer, a string of digital as a whole to process or operate, called a computer word, abbreviated word. The word is usually divided into several bytes (each byte is typically 8 bits). In memory, it is common for each cell to store one word, so each word is addressable. The length of the word is represented by the number of digits. In computer operators, controllers, usually in the word is transmitted in units. Words appear at different addresses whose meanings are not the same. For example, the word sent to the controller is an instruction, and the word sent to the operator is a number.Word lengthThe number of bits that each word of the computer contains is referred to as the length. Depending on the computer, there are two types of word length that are fixed and variable. Fixed word length, that is, no matter what the case is fixed constant, variable length, in a certain range, its size is variable. The calculated word length refers to the number of binary digits that it can handle at one time. The rate at which a computer processes data is naturally related to the number of bits it can process at a time and the speed of its operation. If the word length of a computer is twice times that of another computer, even if the speed of the two computers is the same, the former can do twice times the latter in the same period of time. Generally speaking, the word length of the mainframe computer is 32-64 bits, the small machine is 12-32 bits, and the microcomputer is 4-16 bits. Word length is an important factor in measuring the performance of a computer.bytesByte refers to a small group of contiguous binary digital. is usually 8 bits as a byte. It is a small unit of information, and as a whole to participate in operations, smaller than words, is the unit of the constituent words. In a microcomputer, how many bytes are usually used to represent the storage capacity of the memory. For example, in a C + + data type representation, a char is typically 1 bytes, an int is 4 bytes, and a double is 8 bytes. The key to understanding coding is to understand the concept of the character and the concept of the byte accurately. These two concepts are easy to confuse, and we'll make a distinction here: The concept describes an example of a character that people use, a symbol in an abstract sense. ' 1 ', ' Medium ', ' a ', ' $ ', ' ¥ ' ... Bytes A unit of data stored in a computer, a 8-bit binary number, is a very specific storage space. 0x01, 0x45, 0xFA ...stringIn memory, if the "character" is in ANSI encoded form, one character may be represented by one byte or more bytes, then we call this string an ANSI string or a multibyte string. For example, "Chinese 123" (Accounting for 8 bytes, including a hidden).Character SetFor ANSI encoding, there are different character sets (Charset). The same sequence of bytes, the characters represented under different character sets are not the same. To correctly parse an ANSI string, you also choose the correct character set, otherwise it can cause the so-called garbled phenomenon. There is a default character set for different language versions of the operating system. This character set is used by the system to resolve ANSI strings without specifying a character set. In other words, if we open an ANSI text file (a text file containing only ANSI strings) that was saved by the Japanese operating system under the Simplified Chinese version of Windows, we will see garbled characters. However, if we open this file with an encoded selection of text editor such as Visual Studio, and choose the correct character set, we will be able to see its original appearance. Note: The traditional and traditional Chinese characters in the Chinese character set are not necessarily the same (it turns out to be quite different). Each character set has a unique number, called a code page. The code page for Simplified Chinese (GB2312) is 936, and the system default character set has a code page of 0, which indicates that a suitable character set is selected based on the language settings of the system.UnicodeString in memory, if "character" exists in Unicode, then we call this string a Unicode string or a wide-byte string. In Unicode, each character occupies two bytes. For example, "Chinese 123" (10 bytes). The difference between Unicode and ANSI is equivalent to the "full-width" and "half-width" differences within the input method. Since the standards set by different ANSI encodings are not the same (different character sets), for a given multibyte string, we must know which character set it takes to know what character it contains. For a Unicode string, the "character" content it represents is always the same, regardless of the environment. Unicode has a uniform standard that defines the encoding of most characters in the world, so that Latin, digital, Simplified Chinese, Traditional Chinese, and Japanese can all be saved in the same encoding. Data type
uninterpreted
? bit element ? bytes ? Trit ? Tryte
? Word
value
?  integer ?  fixed-point ?   floating point ?  rational
? complex ?  bignum ?  interval &NBSP;
&NBSP;
text
?   character ?   string &NBSP; &NBSP;
&NBSP;
Pointer
? Physical Address ? Reference
Combination
? Algebraic data type ? Array ? Associative array ? Class
? List ? Object ? Option Type ? Product
? Record ? Set ? Union
other
? Boolean type ? Bottom Type ? Collection ? enumerated type
? Exception ? first-class function ? Opaque Data Type ? Recursive Data Type
? Signal Label ? String Stream ? Top Type ? Type class
? Unit Type ? Void
Related Topics
? Abstract Data Type ? Data Structure ? Interface ? Kind
? Original Type ? subtyping ? Template ? Type Constructor
? Parametric polymorphism

Bytes-Basic knowledge

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.