- バックアップ一覧
- ソース を表示
- Binary Number Systems は削除されています。
- 1 (2018-06-11 (月) 02:14:53)
- 2 (2018-06-11 (月) 02:40:00)
- 3 (2018-06-11 (月) 16:14:40)
*4 (2018-06-15 (金) 05:38:35)*

- 追加された行はこの色です。
- 削除された行はこの色です。

#author("2018-06-15T05:38:35+09:00","","") *Binary Number Systems [#m229bfca] **Binary Numbers [#j62f5801] Is a number system with a numerical notation to the base 2, in which each place of a number, expressed as 0 or 1, corresponds to a power of 2. [1] Examples: Decimal - Binary 1.) 3 - 0011 2.) 17 - 10001 3.) 299 - 100101011 **Decimal to Binary Conversion [#iaf18de3] #ref(binary-representation.png,left,50%) Image 1.1 In the binary system, the weight of each digit increases by the factor of 2. The first digit has a weight of 1(2^0), the second digit has a weight of 2(2^1), the third a weight of 4(2^2), the fourth a weight of 8(2^3) and so on. ***Conversion [#ge58cca7] An easy way to convert decimals to binary is to use the repeated division by 2 method. Steps 1.) Divide the number by 2. 2.) If the remainder is 0, add 0 to the headof the string of bits. If the remainder is 1, add 1 to the head of the string of bits. 3.) The decimal number now becomes the quotient(decimal number = quotient). 4.) If number is not equal 0, repeat step 1. If the number is equal to 0, end the process. Example 1.1) Decimal = 294, quotient = 147 | bits: null 1.2) Remainder = 0 | bits: 0 1.3) Decimal = 147, quotient = 0 | bits: 0 1.4) true | bits: 0 2.1) Decimal = 147, quotient = 73 | bits: 0 2.2) Remainder = 1 | bits: 10 2.3) Decimal = 73, quotient = 0 | bits: 10 2.4) true | bits: 0 3.1) Decimal = 73, quotient = 36 | bits: 10 3.2) Remainder 1 | bits: 110 3.3) Decimal = 36, quotient = 0 | bits: 110 3.4) true 4.1) Decimal = 36, quotient = 18 | bits: 110 4.2) Remainder = 0 | bits: 0110 4.3) Decimal = 18, quotient = 0 | bits: 0110 4.4) true 5.1) Decimal = 18, quotient = 9 | bits: 0110 5.2) Remainder = 0 | bits: 00110 5.3) Decimal = 9, quotient = 0 | bits: 00110 5.4) true 6.1) Decimal = 9, quotient = 4 | bits: 00110 6.2) Remainder = 1 | bits: 100110 6.3) Decimal = 4, quotient 0 | bits: 100110 6.4) true 7.1) Decimal = 4, quotient = 2 | bits: 100110 7.2) Remainder = 0 | bits: 0100110 7.3) Decimal = 2 | bits: 0100110 7.4) true 8.1) Decimal = 2, quotient = 1 | bits: 0100110 8.2) Remainder = 0 | bits: 00100110 8.3) Decimal = 1, quotient = 0 | bits: 00100110 8.4) true 9.1) Decimal = 1, quotient = 0 | bits: 00100110 9.2) Remainder = 1 | bits: 100100110 9.3) Decimal = 0, quotient = 0 | bits: 100100110 9.4) false Result: 100100110 **Binary Fractions as Weighted Representations [#ecbae1ca] In the context of computer architecture, fractional numbers are referred to the exponential representation of numbers more precise than the base unit. In other words, each floating point values are expressed as a pair of information about the value of each digits and their corresponding digit numbers. For example, 43.39 in base-10 is expressed as 4*10^1, 3*10^0, 3*10^(-1), 9*10^(-2). Fractional numbers can be interpreted as a weighted expression of each value of each digits. In base-10, weights are referred to the powered tens multiplied onto each digit such as 10^3. Each weight depict how much impact each digit values have on the amount of the represented number. Binary fractions are fractional representations in base-2, and the same principle as the case with base-10 is applied here as well. For example, 10.11 in base-2 is represented as 1*2^1, 0*2^0, 1*2^(-1), 1*2^(-2). [2] **Binary Coded Decimal (BCD) [#w99c25ef] Binary Coded Decimal is a representation of decimal numbers used for converting non binary numbers to binary, where each digit of such numbers are converted to sets of n-bit binary codes. This means that binary representations of each digit values cannot exceed the binary representation of (max is 9). In the case of decimal numbers, each digit representations cannot exceed 1001, therefore, BCD for decimal numbers should only need 4-bit binary codes for each digits. Example: Decimal = 427, BCD = 0100(4) 0010(2) 0111(7) Decimal = 15, BCD = 0001(1) 0101(5) Decimal = 1036, BCD = 0001(1) 0000(0) 0011(3) 0110(6) Since each base-10 digit has a max of 9, bits 1010(10), 1011(11), 1100(12), 1101(13), 1110(14), and 1111(15) cannot be used. Since BCD to base-n conversion requires each BCD digit representations not to exceed 9, during application, BCDs are usually converted to binary and later back to base-n. Such conversions have the advantage of being more efficient than simply converting base-n to binary while having the downside of difficulty in using BCD for other purposes. Advantages -Represented in groups of 4, similar to Hexadecimal -Easy conversion between base-10 and binary(or base-2) -Fast and efficient system to convert the decimal numbers into binary numbers as compared to the pure binary system. Disadvantages -Wasteful as states 1010, 1011, 1100, 1101, 1111 cannot be used ***Conversion [#q1cfd339] To convert decimal(base-10) to BCD, do the following steps: 1.) Split the decimal digits into their respective weights 2.) Convert each digit to their binary counter parts in the 8421 BCD code Examples: Decimal 101 1.1) 1 | 0 | 1 1.2) 0001 | 0000 | 0001 Decimal 976 1.1) 9 | 7 | 6 1.2) 1001 | 0111 | 0110 Decimal 83 1.1) 8 | 3 1.2) 1000 | 0011 [3] **Signed Binary Numbers [#qc98d03e] Positive and negative signs in binary codes are represented by adding an additional digit to the code, where 0 is positive and 1 is negative. Signed binary numbers are referred to numbers with such representations. Signed binary numbers consist of two parts: the sign bit, which represents positive or negative states, and the magnitude bits, which represents the magnitude of the number. This means that the disadvantage in which within an n-bit computer, only n-1 bits can be used to depict the amount of the number, is imminent. Another disadvantage can be seen during the depiction of zero, where, during calculation, it is possible that the arithmetic units return either zero with a positive sign or a zero with a negative sign, and represent them as different values even when they are arithmetically the same values. [4] ***1’s Complement [#f886446c] 1’s Complement is a signed binary representation in which negative numbers are represented by inverting, or switching all 1s and 0s of, positive signed binary numbers. Such representation allows addition and subtraction of positive and negative numbers to be executed fairly simply as shown below. (Decimal) 5 + (-6) = -1 (1’s Complement) 00101 + 11001 = 1110 (Decimal) 115 - 27 = 88 (1’s Complement) 01110011 + 00011011 = 101010111 For each answer, the existence of a n+1th digit, called overflow, indicates that the value is positive, and the absence indicates otherwise. In order to read the positive answers overflow digit is ignored and a 1 is added to the answer. In the second example, 101010111 is interpreted as 01010111 + 1 = 01011000, or 88 in decimal. [3] ***2’s Complement [#q9937ce7] Unlike 1’s Complement representation, 2’s complement depicts negative numbers N of a positive counterpart P with the following equation. N + P = 0 In this case the arithmetics below can be calculated as such. (Decimal) 115 - 27 = 88 (1’s Complement) 01110011 + 11100101 = 101011000 The overflow in 101011000 can be ignored and represented as 01011000. [3] **Sources: [#n5339b89] [1]“Binary Number.” Dictionary.com, Dictionary.com, www.dictionary.com/browse/binary--number. [2]“Binary Fractions and Fractional Binary Numbers.” Basic Electronics Tutorials, AspenCore Inc., 23 Feb. 2018, www.electronics-tutorials.ws/binary/binary-fractions.html. [3]“Binary Coded Decimal or BCD Numbering System.” Basic Electronics Tutorials, AspenCore Inc., 23 Jan. 2018, www.electronics-tutorials.ws/binary/binary-coded-decimal.html. [4]“Signed Binary Numbers and Two's Complement Used in Binary.” Basic Electronics Tutorials, AspenCore Inc., 28 May 2018, www.electronics-tutorials.ws/binary/signed-binary-numbers.html.