Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
what is the coding of numbers in a computer?
Positional number systems As part of the introduction will approximate knowledge of elementary number theory. The word "number" is seen as an abstract concept, which is ideal wkom- ponowuje the idea of programming. Originally, the number served only to periods Słania collections of objects, and for this purpose only used natural numbers. When in the seventeenth century BC Egypt introduced rational numbers and about. thousand years later in Greece started to use irrational numbers, the numbers began to be used also to express the size of sets of continuous, such as length, area, volume and weight. In the development of computational methods and computer techniques are essential principles of writing (reading) integers. For this purpose the pledge of characters, called numbers. Because of the way the interpretation of the ranking numbers, divided into the following two systems of writing numbers: • additive, where the stored value is the sum of the arithmetic mean of the individual characters; One example is a one nature, in which the vertical line is single, and the multiple repetition gives the corresponding numerical value; in more advanced additive systems (eg. ere were thenceforth in Egyptian hieroglyphic writing and numbering Greek) is more diverse symbolism, in which characters are used to separate przedstawia- ing different units numbering; • position, the method of notation is characterized in that the value of the individual digits depends on their position in the record; position of the character can be considered with respect to either the adjacent characters (an example of such Roman numbering system is where the greater number precedes a positive value smaller and smaller number located in front of the larger SZA - negative value) or mark the end (the set of numbers is nazywa- ny positional number system). Let us now describe the positional number systems, which are characterized by short-circuit the record, and perform actions on them accounting is very simple. The number of recorded figures c (j) belonging to a small set of size p, where the index j ∈ [1, p]. In contrast, the value of such a number is the sum of the products of partial numbers represented by individual digits and powers of a natural number p, called the base numerical system, with exponents equal to the number of digits in the position. This can be written as follows: (wartość_liczby)10 = c (j) ⋅pn-1 + c (j) ⋅pn-2 + c (j) ⋅pn-3 + ... + c (j) ⋅p1 + c ( j) ⋅p0,. According to the basic classification, ie. Due to the size of the set of numbers c (j), we can distinguish three basic positional number systems. These are systems: • Decimal (p =10), which is now natural for man and widely used in all areas; • binary (p =2), which is of particular importance to science, since it is natural for calculating machines; • Hex (p =16), which, due to its characteristics is commonly used in the process of computer programming. The binary number system binary (binary stands. Binary) enables you to record numbers using two notations, ie. Zero (0) and ones (1). That conventionality record to suggest that these characters are able to express two extreme states of any free electronic system without going into details, eg. What is the voltage at the circuit layout. From a practical point of view, no voltage is represented by zero, and each voltage with a value greater than zero is treated equally - ie. Represented by the number one. This property of the number system makes it a natural for electronic devices (computers). The following example shows an example of the conversion of a binary number to a decimal number. This is done in accordance with the principle set out in formula (1101)2 =1⋅231⋅22 + + +0⋅211⋅20 = (13). The next example shows how to convert a decimal number to its binary equivalent. As is clear from the expression, it is a task long as such algorithmic. First, the number is divided by two and the result of the quotient is truncated to an integer. This operation is repeated recursively until no value less than unity. Each result of the quotient is subjected to analysis. If the result is a rational number (that is, the rest formed tion, division), the binary number is obtained by inserting into it, starting from the sign "1". Otherwise - the digit "0". (13)10 =132 =6 ...6:2 =332 =1, ...12 =0, ..., the rest of the residue11 ⇒ ⇒ ⇒ residue1 ~ remainder0 ⇒ =. (1101)2 (1.3) where the symbol "~" means the negation operator. The hexadecimal system hexadecimal (hex stands. Hexadecimal) makes the switch ma- pis numbers with up to sixteen characters. This set of characters consists of ten Arabic numerals (0,1, ...,8,9) and six characters of the Latin alphabet (A, B, C, D, E, F) representing a decimal value from10 to15. A characteristic feature of this numerical system is that you can use it to save the long binary numbers in a concise form. One digit number hexane sadecymalnej encodes a binary value consisting of a maximum of four forgery. The following example shows an example of a method recounted in the number of hexadecimal to decimal. (12A)16 =2⋅1611⋅162 + + (10)10⋅160 = (298)10. While a further expression shows a method of changing the number of decimal to hexadecimal tion. The idea is basically similar to that in the case of expression, with the difference that the resulting quotient is multiplied with the rest of the base of the hexadecimal system. This allows you to determine the converted digit number. (298)10 =29816 =18,625182 =1.1251:2 =0.0625 0.62516 = (10) (A)1016⋅ ⇒ 0.062516 = (1) (1)1016 ⋅⇒ =0.12516 (2) (2)1016 ⋅⇒ =. (12A)16 ⇒ ⇒ ⇒ The following example explains the principle of converting a hexadecimal number to its binary equivalent. Consider again the number (12A)16, which can be converted to binary recording in accordance with the following: (12A)16 = [(1) ∪16 (2)16 ∪ (A)16] where each partial number expressed in hexadecimal and on the right side of the equation must be converted into binary form on the basis of the following calculations: (1)16 =1:2 =0, ..., rest1 ⇒ =, (0001)2 (2)16 =2: 2 =112 =0, ...,0 ~ rest rest ⇒ ⇒ =1, (0010)2 (A)16 =102 =552 =2, ...22 =11 2 =0, ...,0 ⇒ ~ rest rest rest ~10 ⇒ ⇒ ⇒ = residue1. (1010)2 can finally be written: (12A)16 = (0001)2 ∪ (0010)2 ∪ (1010)2 = (100,101,010)2, wherein, at the end of the binary notation all leading zeros are removed. Hence it follows that each digit numbers stored in hexadecimal system dimensions can be converted into binary form, which is also a partial number of the final number of binary characters. This is an important feature, which determines the suitability of hexadecimal in the process of programming computers. Storing numbers in a computer memory in the computer field, the numbers are represented by a bi-nary system. It is a natural and comfortable at the same time due to construction of computer memory. Encoding of integers is a trivial issue, but already in the case of real numbers, writing them is a complex process. At the same time, keep in mind that the numbers stored in the computer are only a subset of integers or real. Consider the way the total number of integer encoded using eight bits. The construction of an eight bit cells (ie. Single byte), in the context of storing an integer value. The bits represent one character used to write the number in binary. In addition, this figure shows an example of the conversion number ()2, inscribed in binary the number (69)10 decimal. In this case, the initial zeros in binary notation is not removed because they represent senting bits of memory. Analyzing how to record your computer integer can be concluded that using eight-bit encoding can be represented only256 values. The lowest value is0, while the largest255 However, the question arises: how to encode negative integers? The solution to this problem is that to represent the absolute value of the number of bits used number from0 to6 and bit7 stores information about the mark, numer bit + + + + + + + () =2 = (69)10 value in the decimal system ie.0 is a positive number and1 - a negative number. Of course, in this case, still have the ability to encode the256 values, but the range from -128 to +127. To increase the number of values for integer, in practice, a representation of a16-bit,32-bit,64-bit and128-bit, where the last bit is reserved for storing information about the sign. Real Numbers are stored on your computer using floating point representation tion (with English. Floating point) stored in the form of exponential Appeal: Number = ± m⋅2e, (1.9) where m is the mantissa with a value1≤m < 2, and e is the exponential weights. The base is fixed and is2, which is determined by the binary number system. Mantissa, exponent and the sign of the number is stored separately in individual boxes memory. Sign of the number is always one bit and has a value of0 if the number is positive, or1 if it is negative. On the record mantissa M and E for the exponent are defined, fixed number of bits. This means that using this representation can be represented by a finite number of values. The accuracy of saved number is the greater, the longer the mantissa. While the range of the number is determined by the length of the exponent. In principle, any number can be written in the form of a floating-point number of ways. To standardize the form of encoding real numbers, adopted a limitation on the scope of the mantissa and the exponent that governs the IEEE754 In addition, the first significant digit of the mantissa is always1 and is not explicitly stored. Thus, you can save that: (mmmm)2 = (1, MMMM)2, where: mmmm - is the value of the mantissa in the code dwójowym, which is used in the formula; MMMM - is the number of mantissa bits stored in computer memory and represents the fractional part. In turn, the value of the exponent of the number is dependent on the length of the bit field and carries ITY (e)2 = (E)2 - (2p-1 -1)10, where: e - exponent in the binary code used, depending, E - exponent (feature) stored in the memory, p - the number of bits in the exponent wowanych System reserved. The expression2p-1 As an example, the number2.05 is saved by adopting coding16-bit floating-point. Since the exponent field consists of four bits, in accordance with the shift pattern is -6. Based on the relationship write down the development of the present number, ie:2.05 = +1,025⋅2 (7-6). In the case of the exponent, in computer memory, save the number7, so characteristic of the binary code is: E = (0111)2. On the other hand, in the case of the mantissa, in memory should store the number0,025. It turns out that, when there is a field consisting of11 bits, possible to save this number in the standardized binary code is impossible. This number should be rounded to the value0., ie .: M = ()2, or cut to the value of0., which can be written as: M = ()2. numer bit MMMEEEEz MMMMMMMM exponent mantysaznak No2bajt byte1 2-32 -22 --11 -92 -82 -72 -62 -52 -4 value in the decimal system Therefore, due to the specified accuracy of the numbers using positional variability represent16-bit, rather than the number of2.05 is obtained one of the following two numbers: →2..0110011 →0 where the bits are set accordance with the adopted representation of the number. The example also explains the reason for the occurrence of errors in the calculations performed using floating point numbers. Let us now return to said IEEE754 standard, which is widely applicable standard retention policy specifies the number of variables nopozycyjnych in modern computers. This standard also defines a base perform arithmetic calculations on these numbers, which provides non-volatility action programs that run on different computers. At the same time it is worth noting that for operations on floating-point numbers correspond to a completely different processor than the circuits for operation on numbers Callan kowitych, in accordance with the recommendations of the said standard, floating-point numbers to be stored in the following formats • single precision format (single) - it is32 -bit format in which to mantissa (normalized with hidden a One before the decimal) was allocated23 bits, and exponent -8 bits; • format double-precision (double) -64-bit format, where the mantissa reserved52 bits, and11 bits allocated to the exponent; • the format of the extended precision of up to128 bits, where the mantissa was allocated111 bits, and exponent -16 bits. A characteristic feature of floating-point representation is a relatively large gap between the first positive and negative value encoded (ie. -2Emin +2Emax). This interval is called the undercounting. Surprisingly, by the above-discussed number of floating point representation, the mantissa is normalized, and has a value between1≤m <2 encoding is not possible to zero - see equation. Therefore, the IEEE754 standard specifies certain codes for special applications. These are codes in which the exponent is set to the minimum or maximum, namely • Zero is represented by a code, in which all the bits of the exponent and mantissa are reset, and the distinguished zero positive (when the sign bit is0) and zero negative (bit character -1); • infinity is encoded in such a way that all the bits of exponent speaker are set to1, and bits of mantissa -0; • NaN (with English. Not A Number) - the so-called. "Non-number", for example. Outcome of the square root of the number of non-negative, are coded in such a way that all heavy exponent bits have a value of1, and the mantissa is non-zero; • the number close to zero is encoded in such a way that the bits of the exponent is important to set the zero and the mantissa has a hidden zero as a significant figure before the decimal pretty. It is assumed that the value of the mantissa in the formula is contained in the range0≤m <1, and e is the exponent (e)2 = - (2p-1 +2)10.
Cofnij zmiany
The procedure which we have followed in our College Microprocessor lab ,the same is to be applied.,
The basic steps which we follow for8bit ,16bit numbers is
1.Loading the number/moving direclty
2.Moving it from accumulator to register
3.loop/action to be performed
4.Halting
Ex:8085 Code to multiply by2
MVI A,32H
RLC
STA 8200H
HLT
its binary system wich used0 &1
0 and1.
All computer use a binary number system. This system has2 numbers: zero and one.
The reason for using a binary number system is making a computer operate faster than a computer that uses a three-number system, four-number system...etc.
Tomasz you ask a lot !
it is Binary, binary system is use only two numbers0 and1 and all data in this in computer is formated in a zeros and ones streme.
BINARY NUMBER(0'S OR1'S)
simply coded in0's and1's (binary)
A system of symbols and rules used to represent instructions to a computer; a computer program.