## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

March-2003

Introduction

A number system defines a set of values used to represent quantity. We talk about the number of people attending class, the number of modules taken per student, and also use numbers to represent grades achieved by students in tests. Quantifying values and items in relation to each other is helpful for us to make sense of our environment. We do this at an early age; figuring out if we have more toys to play with, more presents, more lollies and so on. The study of number systems is not just limited to computers. We apply numbers every day, and knowing how numbers work will give us an insight into how a computer manipulates and stores numbers.

The Romans devised a number system which could represent all the numbers from 1 to 1,000,000 using only seven symbols I = 1 V = 5 X = 10 L = 50 C = 100 D = 500 M = 1000 A small bar placed above a symbol indicates the number is multiplied by 1000.

8. 4. Base ten number systems are called decimal number systems. . 0. and 9. 5. 6. In decimal we have ten numerals. 7. 1. 2. 3.The Decimal Number System The primary number system used is a base ten number system.

. And so on. Then we reset the ones place to zero and increment the tens place to get 20. with zeros to the right of the 3. The next number is 10. We continue to count by adding one to the ones place until we run out of digits again at 19. So the number after 299 is 300. That is.Counting in decimal: When we count. We continue in this way until we reach 99. we create a place for the tens digit and put zero in the ones position. Each time we change a digit. all the digits to its right are set to zero. we start at 1 and count up to 9. At that point we create a third digit to hold hundreds and reset the tens and ones place to zero to get 100.

.9000 9 * 1000 9 * 103 + 700 9735 = + 30 is equivalent to 7 * 100 is equivalent to 3 * 10 7 * 102 3 * 101 +5 5*1 5 * 100 So 9735 = (9 * 103) + (7 * 102) + (3 * 101) + (5 * 100).

**The Octal Number System
**

We can use a number system with only eight numerals,

0 through 7. A system with only eight numerals is called octal.

Counting in Octal

In octal, instead of ten digits, we only have eight. So we resort to changing the digits to the left more frequently. Counting in base 8, we get:

0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 20 21 22 23 24 25 26 27

**Since the octal number 10 follows 7, 10 in octal is 8 in decimal. 11 in octal is 9 in decimal. And so on.
**

octaldecimal 0-0 1-1 2-2 3-3 4-4 5-5 6-6 7-7 octaldecimal 10 - 8 11 - 9 12 - 10 13 - 11 14 - 12 15 - 13 16 - 14 17 - 15 octaldecimal 20 - 16 21 - 17 22 - 18 23 - 19 ... 24 - 20 25 - 21 26 - 22 27 - 23 74 - 60 75 - 61 76 - 62 77 - 63 104 - 68 105 - 69 106 - 70 107 - 71 octaldecimal octaldecimal 70 - 56 71 - 57 72 - 58 73 - 59 octaldecimal 100 - 64 101 - 65 102 - 66 103 - 67 ... octaldecimal

.Octal Digit Positions and Values In base 8. each digit occupies a position worth eight times the position to its right. So 5732 (octal) is 3034 (decimal). So if 5732 is an octal number. instead of ten times as in base 10. it can be read as: 5732 = 5000 (octal) = + 700 (octal) = + 30 (octal) = + 2 (octal) = 5 * 1000 (octal) = 7 * 100 (octal) = 3 * 10 (octal) = 2 * 1 (octal) = 5 * 83 = 7 * 82 = 3 * 81 = 2 * 80 = 5 * 512 (decimal) = 7 * 64 (decimal) = 3 * 8 (decimal) = 2 * 1 (decimal) = 2560 (decimal) 448 (decimal) 24 (decimal) 2 (decimal) Total = 3034 (decimal) We total the decimal values of each octal digit to get the decimal equivalent.

we simply repeat To convert 3034 in decimal to octal. the second remainder will be the second digit from the right. The first remainder will be the last digit in the octal number.To convert a decimal number to dividing by 8 and saving the remainder. octal. all we need to do is write the remainders right-to-left as we divide by 8: Step Divide Equals Remainder (1) (3) (5) (6) 3034 / 8 = 379 / 8 = 47 / 8 = 5/8= 379 47 5 0 2 3 7 5 Digits 2 32 732 5732 . and so on. start by dividing 3034 by 8 to get 379 with a remainder of 2. That is.

then use the letters A for 10. C for 12. . E for 14 and F for 15.The Hexadecimal Number System We can use a number system with sixteen numerals. We can use our usual 0 through 9 for the first ten digits. B for 11. A base 16 number system is call hexadecimal or just hex. D for 13.

we get: 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F . we count the same same way we did in decimal and octal. we have sixteen. But instead of ten digits or eight digits. Counting in base 16. So we resort to changing the digits to the left less frequently than in decimal or octal. A-F. 0-9.Counting in Hexadecimal In hexadecimal.

246 106 .Since the hex number A follows 9. After F in hex (15 in decimal) we have 10 (16 in decimal). 8-8 18 .19 23 .27 2B .24 28 .32 F0 ..43 FB .258 3-3 13 . B in hex is 11 in decimal.37 F5 .262 7-7 17 .269 F . hex-dec hex-dec hex-dec hex-dec hex-dec hex-dec hex-dec 0-0 10 .15 1F ..18 22 .264 9-9 19 .240 100 .29 2D .39 F7 .30 2E .25 29 .40 F8 .34 F2 .260 5-5 15 .23 27 .255 10F .42 FA .271 .22 26 .265 A .248 108 ..48 FF .244 104 .253 10D .46 FD .241 101 .251 10B .247 107 .252 10C .35 F3 .. And so on.267 C .12 1C .41 F9 .256 1-1 11 .249 109 .259 4-4 14 .243 103 .21 25 .261 6-6 16 .17 21 .10 1A .245 105 .20 24 .14 1E .253 10D .31 2F .263 .33 F1 .13 1D .45 FD .266 B .268 D .269 E .257 2-2 12 .250 10A .28 2C .11 1B .36 F4 .44 FC . A in hex is 10 in decimal.16 20 .242 102 .38 F6 . .26 2A .

So if 3F72 is an hex number.Hex Digit Positions and Values In base 16. it can be read as: 3F72 = 3000 (hex) = + F00 (hex) = + 70 (hex) = + 2 (hex) = 3 * 1000 (hex) = F * 100 (hex) = 7 * 10 (hex) = 2 * 1 (hex) = 3 * 163 = 15 * 162 = 7 * 161 = 2 * 160 = 3 * 4096 (decimal) = 15 * 256 (decimal) = 7 * 16 (decimal) = 2 * 1 (decimal) = 12288 (decimal) 3840 (decimal) 112 (decimal) 2 (decimal) Total = 16242 (decimal) We total the decimal values of each hex digit to get the decimal equivalent. So 3F72 (hex) is 16242 (decimal). each digit occupies a position worth sixteen times the position to its right. . instead of ten times as in base 10 or eight times as in octal.

In the following steps we convert 16242 from decimal to hex: Step (1) (2) (3) (4) Divide 16242 / 16 = 1015 / 16 = 63 / 16 = 3 / 16 = Equals 1015 63 3 0 Remainder 2 = 2 (hex) 7 = 7 (hex) 15 = F (hex) 3 = 3 (hex) Digits 2 72 F72 3F72 So 16242 in decimal is written as 3F72 in hex. The only difference is that we divide by 16 each time since we are working in base 16.Converting Decimal to Hex We can convert a decimal to hex using the same procedure we used to convert decimal to octal. .

01001001010101110101010001010101101 10101010000000111101010101011111010 .The Binary Number System The base 2 number system. called binary is based on powers of 2 and contains only two digits. 0 and 1.

Counting in Binary With only two numerals. 1 (one) and 0 (zero). Just keep in mind the following: 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 10 1 + 1 + 1 = 11 . counting in binary is pretty simple.

5 110 .30 11111 .6 111 .We we would count in binary as follows: bin-dec 0-0 1-1 10 .2 11 .17 10010 .31 .13 1110 .24 11001 .3 100 .10 1011 .9 1010 .27 11100 .15 bin-dec 10000 .22 10111 .18 10011 .23 bin-dec 11000 .11 1100 .16 10001 .25 11010 .21 10110 .7 bin-dec 1000 .28 11101 .14 1111 .8 1001 .19 10100 .12 1101 .29 11110 .20 10101 .26 11011 .4 101 .

it can be read as: . each digit occupies a position worth two times the position to its right. eight times as in octal.Binary Digit Positions and Values In base 2. instead of ten times as in base 10. or 16 as in hex. So if 1101001 is a binary number.

1101001 = 1000000 (bin) = 1 * 26 = 1 * 64 (decimal) = 64 (decimal) + 100000 (bin) = + 00000 (bin) = 1 * 25 = 1 * 32 (decimal) = 32 (decimal) 0 * 24 = 0 * 16 (decimal) = 1 * 8 (decimal) = 0 * 4 (decimal) = 0 * 2 (decimal) = 1 * 1 (decimal) = 0 (decimal) 8 (decimal) 0 (decimal) 0 (decimal) 1 (decimal) + 1000 (bin) = 1 * 23 = + 000 (bin) = + 00 (bin) = + 1 (bin) = 0 * 22 = 0 * 21 = 1 * 20 = TOTAL = 105 (decimal) We total the decimal values of each binary digit to get the decimal equivalent. So 1101001 (binary) is 105 (decimal). .

. In the following steps we convert 105 from decimal to binary: Step Divide Equals Remainder Digits (1) (2) (3) (4) (5) (6) (7) 105 / 2 = 52 / 2 = 26 / 2 = 13 / 2 = 6/2= 3/2= 1/2= 52 26 13 6 3 1 0 1 0 0 1 0 1 1 1 01 001 1001 01001 101001 1101001 So 105 in decimal is written as 1101001 in binary.Converting Decimal to Binary We can convert a decimal to binary by dividing by 2 each time since we are working in base 2.

and 8 is 23.7 .6 111 .26 .30 11111 . the connection is even more obvious: bin-octal-dec 0-0-0 1-1-1 10 .20 10101 .15 bin-octal-dec 10000 .13 1110 .12 1101 .19 10100 .29 11110 .9 1010 . That is.15 .24 .26 11011 . octal and hex is simple.32 .28 11101 .21 .25 11010 . Octal is base 8.31 .8 1001 . If we line up the binary numbers and octal numbers.27 .4 101 .5 110 .31 .7 bin-octal-dec 1000 . Octal and Binary Converting between binary.2 11 .23 bin-octal-dec 11000 .10 .11 .33 .11 1100 .13 .Converting Between Hex.14 .25 .21 10110 .10 1011 .27 11100 .18 10011 .17 .14 1111 .5 .34 .37 . it takes exactly three binary digits to make one octal digit.16 10001 .3 .2 .16 .12 .22 .6 .36 .17 10010 .35 . Binary is base 2.3 100 .22 10111 .23 .4 .24 11001 .30 .20 .

we get: 10 110 100 111 100 101 101 001 011 2 6 4 7 4 5 5 1 3 That is. If we take the digits in groups of three from right to left and convert. . 10110100111100101101001011 (binary) is 264745513 (octal). Consider the binary number 10110100111100101101001011.What this means is that we can convert from binary to octal simply by taking the binary digits in groups of three and converting.

all we have to do is convert each octal digit to three binary digits.Converting from octal to binary is just as easy.) . Converting 7563021 in octal to binary goes as follows: 7 111 5 101 6 110 3 011 0 000 2 010 1 001 So 7563021 (octal) is 111101110011000010001 (binary. Since each octal digit can be expressed in exactly three binary digits.

For humans. smaller. octal is very useful to programmers. And since it is so easy to convert between binary and octal.Since (almost!) all computers have a binary architecture. and less prone to errors than binary. easier to work with. octal is a favored number system for programmers. octal is more concise. .

By grouping in fours and converting. hex is base 16 and 16 is 24.In the same way. By taking binary digits in groups of four (right to left) we can convert binary to hex. it takes exactly four binary digits to make a hex digit. Consider once more the binary number 10110100111100101101001011. we get: 10 2 1101 D 0011 3 1100 C 1011 B 0100 1011 8 B So 10110100111100101101001011 (binary) is the same number as 2D3CB8B (hex). . That is. and the same number as 264745513 (octal).

. 6F037C2 (hex) is 110111100000011011111000010 (binary).Converting from hex to binary. In this way we can convert 6F037C2: 6 0110 1111 F 0000 0 0011 3 0111 7 1100 C 2 0010 Since we can drop the leading zero. simply write each hex digit as four binary digits.

These days. octal tends to be used by programmers who come from a minicomputer background or who work with unicode. Hex tends to be preferred by programmers with a mainframe background or who work with colors. Many programmers are at home with either. .

Maximum number in a nibble : 1111 = 15 A nibble can be conveniently represented by one hexadecimal digit. .nibble In computers and digital technology. a nibble is four binary digits or half of an eight-bit byte.

or BCD. A decimal digit is represented by four binary digits. . as shown below: The binary combinations 1010 to 1111 are invalid and are not used. is a method of using binary digits to represent the decimal digits 0 through 9.BCD Binary-coded decimal.

4 9 0100 1001 = 01001001BCD (PACKED BCD) Each decimal digit is converted to its binary equivalent. 4910 in binary is 1100012. For example. four bits are used to keep one digit.UNPACKED & PACKED BCD In unpacked BCD. but 4910 in BCD is 01001001BCD. BCD and binary are not the same. one in the lower half and one in the upper half of the byte. so two digits are stored in one byte. . a decimal digit is stored in one byte and in packed BCD.

below each digit write the BCD equivalent of that digit: The BCD equivalent of 26410 is 001001100100BCD . First. For example.BCD Conversion Conversion of decimal to BCD or BCD to decimal is similar to the conversion of hexadecimal to binary and vice versa. let's go through the conversion of 26410 to BCD. then. We'll use the block format that you used in earlier conversions. write out the decimal number to be converted.

simply reverse the process as shown: The DECIMAL equivalent of 100110000011BCD is 98310 .To convert from BCD to decimal.

numbers. . The Extended ASCII Character Set also consists of 128 decimal numbers and ranges from 128 through 255 representing additional special.ASCII Code ASCII. pronounced "ask-key". mathematical. The standard ASCII character set consists of 128 decimal numbers ranging from zero through 127 assigned to letters. and foreign characters. punctuation marks. and the most common special characters. is the common code for microcomputer equipment. graphic.

.The Standard ASCII character set is divided into four groups of 32 characters. The first 32 characters. We call them control characters because they perform various printer/display control operations rather than displaying symbols. form a special set of noncharacters printing characters called the control characters.

There is very little standardization among output devices.Examples of common control characters include: carriage return which positions the cursor to the left side of the current line of characters. line feed which moves the cursor down one line on the output device back space which moves the cursor back one position to the left Unfortunately. different control characters perform different operations on different output devices. you will need to consult its manual. To find out exactly how a control character affects a particular device. .

special characters. and the numeric digits. By subtracting 30h from the ASCII code for any particular digit you can obtain the numeric equivalent of that digit.The second group of 32 ASCII character codes comprise various punctuation symbols. . The most notable characters in this group include the: space character numeric digits 0 through 9 Note that the numeric digits differ from their numeric values only in the high order nibble.

Since there are only 26 different alphabetic characters. group of 32 ASCII character codes are reserved for the lower case alphabetic symbols. and final. The fourth. The ASCII codes for the characters "A" through "Z" lie in the range 41h through 5Ah.The third group of 32 ASCII characters is reserved for the upper case alphabetic characters. . the remaining six codes hold various special symbols. five additional special symbols. and another control character (delete).

The differences between scripts primarily are in their written forms.ISCII Indian Script Code for Information Interchange The ISCII code table is a super-set of all the characters required in the ten Brahmi-based Indian scripts. . where different combination rules get used. An optimal keyboard overlay for these scripts is made possible by the phonetic nature of the alphabet.

. while the Indian script keyboard overlay is designed for the standard English can co-exist with Indian scripts.The 8-bit ISCII code retains the standard ASCII code. so long as 8-bit character codes are allowed. This approach also makes it feasible to use Indian scripts along with existing English computers and software.

provides a logical and intuitive arrangement of vowels and consonants. Alternating between the English and Inscript overlay is achieved through the CAPSLOCK key. The INSCRIPT keyboard. It is based both on the phonetic properties and the relative usage frequencies of the letters. This overlays fits on any existing English keyboard. Not only does this made the keyboard much easier to learn.The common INSCRIPT keyboard overlay allows typing of all the ten Indian scripts. . but also enables a person to type subsequently in all the Indian scripts.

.

whereas the last four bits are the called the digit and identify the specific character. customised for different countries. ASCII are normally used instead. EBCDIC takes up eight bits. The first four bits are called the zone and represent the category of the character. . which are divided in two pieces. There are a number of different versions of EBCDIC.EBCDIC Extended Binary Coded Decimal Interchange Code It is an 8 bit character encoding used on IBM mainframes and AS/400s. Outside of such IBM systems. EBCDIC is generally considered an anachronism. It is descended from punched cards and the corresponding six bit Binary Coded Decimal Code that most of IBM's computer peripherals of the late 1950s and early 1960s used.

.

--. 0 0 1 1 0 1 0 1 --.--.--.--0 01 01 10 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 --.--.--.--.--11 10 10 01 10 01 01 00 . The right bit of the result is placed under the column of bits. The left bit is called the "carry out of the column".The Binary Addition Algorithm To add two 1-bit (representations of) integers: Count the number of ones in a column and write the result in binary.--.--.

A A B Carry Digit Unit Digit 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 1 1 0 1 B 0 0 1 1 0 0 1 1 C 0 1 0 1 0 1 0 1 CARRY 0 0 0 1 0 1 1 1 UNIT 0 1 1 0 1 0 0 1 1 0 0 1 .

.

.

Signed Binary Integers We will not be using a minus sign (-) to represent negative numbers. This has some difficulties. we will use a method called two's complement notation which avoids the pitfalls of one's complement. There are a few ways to represent negative binary numbers. . among them the fact that zero can be represented in two different ways (for an eight bit number these would be 0000 0000 and 1111 1111).. where the sign of a binary number is changed by simply toggling each bit (0's become 1's and vice-versa). The simplest of these methods is called ones complement. We would like to represent our binary numbers with only two symbols. 0 and 1.

The value of bits in signed and unsigned binary numbers Bit 7 Unsi 7 2 = 128 gned Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 26 = 64 25 = 32 24= 16 23= 8 22 = 4 21 = 2 20 = 1 Sign -(27) = -128 26= 64 25 = 32 24= 16 23= 8 ed 22 = 4 21= 2 20 = 1 .To represent an n bit signed binary number the leftmost bit. has a special significance. The difference between a signed and an unsigned number is given in the table below for an 8 bit number.

when Bit 7 is set. . However. the 1111 1111 255 -1 number is always negative.Let's look at how this changes the value of some binary numbers Binary Unsigned Signed If Bit 7 is not set (as in the first example) the 0010 0011 35 35 representation of signed and unsigned numbers 1010 0011 163 -93 is the same. For this reason 1000 0000 128 -128 Bit 7 is sometimes called the sign bit.

Since binary uses only 0 & 1. 11012 = -510 (negative) . | . One solution is to reserve a bit (circuit) that does nothing but represent the mathematical sign: . Extra bit. Extra bit. | . 1=negative) . we don't have a third symbol such as a "minus" sign. 1012 = 510 (positive) . 01012 = 510 (positive) . 1=negative) .NEGATIVE BINARY NUMBER Usually we represent a negative decimal number by placing a minus sign directly to the left of the most significant digit. representing sign (0=positive. just as in the example above. . with -5. . representing sign (0=positive. since these circuits can only be on or off (two possible states).

defining our number limits just as before. However. | .There's another method for representing negative numbers called complementation. a value of negative five would be represented as such: Extra bit. it possesses a negative place-weight value. and the leftmost bit representing either zero or negative eight. we assign the leftmost bit to serve a special purpose. For example. . 10112 = 510 (negative) . (1 x -810) + (0 x 410) + (1 x 210) + (1 x 110) = -510 With the right three bits being able to represent a magnitude from zero through seven. place weight = negative eight . With this strategy. rather. the leftmost bit is more than just a sign bit. . just as we did with the sign-magnitude approach. we can successfully represent any integer number from negative seven (10012 = -810 + 710 = -110) to positive seven (01112 = 010 + 710 = 710). this time.

. Note that the negative binary numbers in the right column. zero 0000 positive one 0001 negative one 1111 positive two 0010 negative two 1110 positive three 0011 negative three 1101 positive four 0100 negative four 1100 positive five 0101 negative five 1011 positive six 0110 negative six 1010 positive seven 0111 negative seven 1001 . don't "count" in the same progression as the positive binary numbers in the left column. being the sum of the right three bits' total plus the negative eight of the leftmost bit.Examples «. the right three bits have to be set at the proper value to equal the desired (negative) total when summed with the negative eight place value of the leftmost bit. Rather.

we would first invert all the bits to obtain 0102 (the "one's complement"). changing all 1's to 0's and visa-versa (to arrive at what is called the one's complement) and then add one! For example. simply invert all the bits of that number. two's complement form. to obtain the two's complement of five (1012). To get the two¶s complement.The two¶s complement : The two's complement for any positive binary number will be whatever value is needed to add to the binary number to make that positive value's negative equivalent. . or -510 in three-bit. then add one to obtain 0112.

but performing the complementation process on all four bits. Then. five (01012).Interestingly enough. converting a positive five to a negative five. inverting all bits to obtain the one's complement: 10102. adding one. . First. including the leftmost (sign) bit at the same time as the magnitude bits. We must be sure to include the 0 (positive) sign bit on the original number. Let's try this with the former example. or -510 expressed in four-bit. two's complement form. generating the two's complement of a binary number works the same if you manipulate all the bits. we obtain the final answer: 10112.

Here. and a negative five as 111110112. If our binary numeration field were such that the eighth bit was designated as the negative-weight bit (100000002). A positive five in this system would be represented as 000001012. the two's complement of five (00001012) would be 11110112. we'd have to determine the two's complement based on all seven of the other bits.It is critically important to remember that the place of the negative-weight bit must be already determined before any two's complement conversions can be done. .

if we can leverage the already familiar (and easier) technique of binary addition to subtract. we'll use those negative binary numbers to subtract through addition. "borrowing" as needed from bits to the left). Here. that would be better. right to left. we can represent negative binary numbers by using the "two's complement" method and a negative place-weight bit. However.Subtraction We can subtract one binary number from another by using the standard techniques adapted for decimal numbers (subtraction of each bit pair. . As we just learned.

all we need is three bits plus the negative-weight bit: positive seven = 01112 negative five = 10112 Now.Carry bits . or positive two. Answer = 00102 Since we've already defined our number bit field as three bits plus the negative-weight bit. which is the correct answer. | . .510 Addition equivalent: 710 + (-510) Represent seven and negative five in binary (two's complemented) form.Subtraction: 710 . 0111 . let's add them together: . -----. + 1011 . 1111 <--. . the fifth bit in the answer (1) will be discarded to give us a result of 00102. 10010 . Discard extra bit .

in two's complement form. we need at least five bits. Converting the answer to decimal form by summing all the bits times their respective weight values. let's add them together . let's represent positive eighteen in binary form. Now. which is twenty-five. we're representing negative twenty-five by using the negative-weight (sixth) bit with a value of negative thirty-two. as it should be. . plus positive seven (binary 1112). plus a sixth bit for the negativeweight bit. 111001 Since there were no "extra" bits on the left. -------. The leftmost bit on the answer is a 1. 1810 = 0100102 . which means that the answer is negative. we must first decide how large our binary bit field must be. we get: (1 x -3210) + (1 x 1610) + (1 x 810) + (1 x 110) = -710 . +2510 = 0110012 (showing all six bits) One's complement of 110012 = 1001102 One's complement + 1 = two's complement = 1001112 -2510 = 1001112 Essentially. showing all six bits: . there are no bits to discard.Another example : add -2510 to 1810 If we want to add -2510 to 1810.Carry bits . To represent the largest (absolute value) number in our problem. 11 <--. + 010010 . 100111 . Now.

we have a representation range of 25. .Overflow One problrm with signed binary numbers is that of overflow. or as low as -3210 (1000002). where the answer to an addition or subtraction problem exceeds the magnitude which can be represented with the alloted number of bits. With the last example problem. or sign. bit. and the result either exceeds +3110 or is less than -3210. Remember that the place of the sign bit is fixed from the beginning of the problem. and the left-most (sixth) bit as the negativeweight. our answer will be incorrect. we used five binary bits to represent the magnitude of the number. If we set up an addition problem with two binary numbers. With five bits to represent magnitude. or thirty-two integer steps from 0 to maximum. the sixth bit used for sign. This means that we can represent a number as high as +3110 (0111112).

1 11 <--. 100100 The answer (1001002). interpreted with the sixth bit as the -3210 place. 1710 = 100012 1910 = 100112 . is actually equal to -2810. + 010011 . -------. (Showing sign bits) 010001 . .Let's try adding 1710 and 1910 to see how this overflow condition works for excessive positive numbers: .Carry bits . not +3610 as we should get with +1710 and +1910 added together! .

Simply put. we have an overflow error. not +3610 as we should get with +1710 and +1910 added together! Obviously. What went wrong? The answer lies in the restrictions of the six-bit number field within which we're working Since the magnitude of the true and proper sum (3610) exceeds the allowable limit for our designated bit field. so whatever figure we obtain using the strategy of discarding the leftmost "carry" bit will be incorrect. is actually equal to -2810. this is not correct.The answer (1001002). interpreted with the sixth bit as the -3210 place. six places doesn't give enough bits to represent the correct sum. .

1 1111 <--. . -1710 = 1011112 -1910 = 1011012 . Discard extra bit FINAL ANSWER: 0111002 = +2810 The (incorrect) answer is a positive twenty-eight.A similar error will occur if we add two negative numbers together to produce a sum that is too low for our six-bit binary field. Let's try adding -1710 and -1910 together to see how this works (or doesn't work. The fact that the real sum of negative seventeen and negative nineteen was too low to be properly represented with a five bit magnitude field and a sixth sign bit is the root cause of this difficulty. -------. as the case may be!): . . 1011100 .Carry bits . + 101101 . | . (Showing sign bits) 101111 .

. and allowing the use of 6 bits for representing the magnitude: . . except this time using the seventh bit for a sign bit. . .Let's try these two problems again. . . . . . . . 1710 + 1910 1 11 0010001 + 0010011 --------0100100 (-1710) + (-1910) 11 1111 1101111 + 1101101 --------11011100 | Discard extra bit 10111002 = -3610 ANSWERS: 01001002 = +3610 By using bit fields sufficiently large to handle the magnitude of the sums. we arrive at the correct answers.

Although this is a valid way of detecting overflow. By checking the signs alone we are able to tell that something is wrong. Perhaps the most elegant solution is to check for the sign of the sum and compare it against the signs of the numbers added. For example. so when the binary sum checked out to be -2810. when adding +1710 and +1910 together. or -1710 plus -1910 giving +2810. we knew that the answer was supposed to be +3610. the whole idea of complementation is to be able to reliably add binary numbers together and not have to doublecheck the result by adding the same numbers together in decimal form! What we need is a simple error-detection method that doesn't require any additional arithmetic. and two negative numbers added together should give a negative result. Notice that whenever we had a condition of overflow in the example problems. After all. two positive numbers added together should give a positive result.In these sample problems we've been able to detect overflow errors by performing the addition problems in decimal form and comparing the results with the binary answers. we knew that something had to be wrong. it is not very efficient. . the sign of the sum was always opposite of the two added numbers: +1710 plus +1910 giving -2810. Obviously.

- Digital Boolean 1.1
- SystemC_v201_LRM
- mcsl-017 (mca) 2016
- Chapter 1
- Mcsl 017 Solved Asignment
- digi_com
- Cheat
- jk
- Micros Lab Book F2010 Aug 29
- Chapter1
- Socha, Norton-Assembly Language for the PC-3rd Edition-1992
- Lec7 Data Representation
- Core Module Exercise > Core_QB03_eng
- IICT_lec_12
- CM105.22to23
- Simply Modbus - Data Communication Test Software - Modbus ASCII vs RTU
- boolean
- Inside Intentional Something Simultaneously Functioning Operating Frequency Opportunity to Enhance Binary Business Benefits of Basic Built in Behaviors Evolve Query String “to Occur to Be Discrete”
- Introduction_ World of Micro Controllers - Book_ PIC Micro Controllers
- Data Types
- MCS-012 Soved Assignment 2015-16.pdf
- f31 Book Arith Pres Pt3
- 2210_y15_sp_1
- 9. Biestables.pdf
- UNIT - I
- Adroit Symbolic Shielding Flow Occurrences Functioning Optimizations of Finance Orders Gather Growing Service-franchise Objects for Factory Overdrive Belongs to Shocking Standby Fashion Optics
- Algebra de Boole y Simplificacion
- ESR meter
- 89020B.pdf
- 529233 C Programming

Close Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Loading