207 views

Uploaded by ganjookomal

save

- HW-1
- 015itmsc31
- CS2202_DPSD (Internal Test-2)
- an083_01
- SP
- SAPScript System Symbol
- 49053182 Matlab Manual
- Matlab tutorium
- Design of Vedic Multiplier for Digital Signal Processing Applications
- Adder Sub Alu
- Alarm & Hardware Investigation
- L8-L9-Fixed Point Arithmetic Mdfd
- Ch 7 Numerical Control
- Badass Tutorial Unit 6 Adders Subtractors
- Mcq Computer Hardware
- Hybrid Fp Fxp Dot Product
- Core Web Application Development With PHP and MySQL - Part 1 & 2
- The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution
- Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
- Dispatches from Pluto: Lost and Found in the Mississippi Delta
- Yes Please
- The Unwinding: An Inner History of the New America
- Sapiens: A Brief History of Humankind
- The Prize: The Epic Quest for Oil, Money & Power
- The Emperor of All Maladies: A Biography of Cancer
- This Changes Everything: Capitalism vs. The Climate
- Grand Pursuit: The Story of Economic Genius
- A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
- Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
- John Adams
- The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
- Smart People Should Build Things: How to Restore Our Culture of Achievement, Build a Path for Entrepreneurs, and Create New Jobs in America
- Rise of ISIS: A Threat We Can't Ignore
- The World Is Flat 3.0: A Brief History of the Twenty-first Century
- The New Confessions of an Economic Hit Man
- Team of Rivals: The Political Genius of Abraham Lincoln
- Bad Feminist: Essays
- Steve Jobs
- Angela's Ashes: A Memoir
- How To Win Friends and Influence People
- The Incarnations: A Novel
- You Too Can Have a Body Like Mine: A Novel
- Extremely Loud and Incredibly Close: A Novel
- The Sympathizer: A Novel (Pulitzer Prize for Fiction)
- The Silver Linings Playbook: A Novel
- Leaving Berlin: A Novel
- The Light Between Oceans: A Novel
- The Flamethrowers: A Novel
- Brooklyn: A Novel
- The Rosie Project: A Novel
- The Blazing World: A Novel
- We Are Not Ourselves: A Novel
- The First Bad Man: A Novel
- The Master
- Bel Canto
- A Man Called Ove: A Novel
- The Love Affairs of Nathaniel P.: A Novel
- Life of Pi
- The Cider House Rules
- My Sister's Keeper: A Novel
- A Prayer for Owen Meany: A Novel
- The Bonfire of the Vanities: A Novel
- Lovers at the Chameleon Club, Paris 1932: A Novel
- The Perks of Being a Wallflower
- The Kitchen House: A Novel
- Beautiful Ruins: A Novel
- Interpreter of Maladies
- The Wallcreeper
- Wolf Hall: A Novel
- The Art of Racing in the Rain: A Novel
- Chapter 1
- Gestar II Mat AAA4 Aluno
- Problemas de Sistema de Unidades
- CONTROL ED MATEMATICA 3er Nivel A martes 7.docx
- cuaderno_2eso.pdf
- Diversificacion II C+T - Ud01
- CONVERSION_UNIDADES.pdf
- temas sueltos de matemáticas
- Nivelamento_aula_01__potenciacao_e_unidades_2017_1
- La notación científica.doc
- Module 1 Integral Exponents (1)
- fisica.pdf
- Laws of Indices
- Física Clasica Mecanica
- Acces-practicas de Bases de Datos Access
- Algarismos significativos
- NUMBER Types of Data and Stored in Oracle
- MATEMATICAS PARA CATV MOD 1
- GU%C3%8DA0
- 978 85 8482 228 7 Calculo Numerico Livro
- Propuesta de planificación de unidad de enseñanza y aprendizaje prueba
- probabilidad_y_estadistica
- 10 step lesson plan
- Analisis Reticular de Segundo Grado Secundaria
- Introducing Mathematics
- Plan de Area Matematica 8 2015
- Maq Clase 1 Unidades Pot Analisis Dim Cifras Sig
- El Hombre Anumerico-John Allen Paulos
- representacion numerica
- INSTITUCIÓN EDUCATIVA-practica 5°.docx

You are on page 1of 40

Structure

1.0 Introduction 1.1 Unit Objectives 1.2 Number Systems

1.2.1 Representation of Integers and Fractions 1.2.2 Conversion of Numbers 1.2.3 Binary-Coded Number

Representation of Information

NOTES

1.4.1 Sign-Magnitude Representation 1.4.2 Complement Method 1.4.3 Overflow

1.5.1 Storage Layout 1.5.2 Overflow and Underflow

Character Codes: ASCII and EBCDIC Summary Key Terms Answers to Check Your Progress Questions and Exercises

1.0 INTRODUCTION

The computer stores all information in the form of binary numbers, i.e., all information stored on a computer is written in machine language that computer understands. This machine language uses binary numbers which comprise of only two symbols, 0 and 1. Thus, a bit (0 or 1) is the smallest unit of data in the binary system. With all possible permutations and combinations of 0 and 1, a complete machine language is developed. A group of eight bits (a byte) can represent 256 separate characters with possible combinations of 0s and 1s. You can also say that a binary numbering system is a binary code in which n bits are used to represent up to 2n distinct combinations of 0s and 1s. The binary information is stored in computer memory or registers. This information can be either control or data information. Control information is a bit or a group of bits that specifies the sequence of command signals needed for giving the instructions to be executed. Data information is the information on which processing is done. It can be in the form of number, Boolean information or text that is stored as binary number or other binary coded information that are operated to achieve the required result.

Self-Instructional Material

Representation of Information

NOTES

Thus, data found in the memory or registers of the computer is classified as: Number used in arithmetic operations Alphabets used for text or data processing Discrete symbols used for specific purpose This unit discusses binary number system in detail, including the representation of integers and floating-points in different number systems, representation of negative integers in binary number system and the ASCII and EBCDIC character codes.

After going through this unit, you will be able to: Understand different number systems Represent integers, floating-points and negative integers in the binary number system Convert numbers from one number system to another Understand the concept of character coding Describe the ASCII and EBCDIC coding schemes

The decimal number system consists of ten digits 0,1,2,3,4,5,6,7,8,9. However, computer systems only recognize binary number system involving only two digits, 0 and 1. The other two number systems which are frequently used for representing these binary numbers in compact form are octal and hexadecimal. Any of these number systems can be used for representing both integers and floating numbers. A number system is defined according to its base, also called radix r, which can be: r = 2, 8, 10, 16 (discussed here) or any other number like 5 or 7, etc. For a given base r , a number system uses a set of r symbols. Thus, set S will have r values ranging from 0 to r1:

S = {s0 , s1 , ..., sr 1}

Thus, all number systems have the following characteristic features: Base or radix is equal to the number of digits in the system, e.g., 8 for octal decimal number and 10 for decimal number. The largest possible value of digit is one less than the radix, e.g., 7 for octal decimal number and 9 for decimal number. The base raised to the appropriate power depending upon the digit position is multipliable with each digit.

Self-Instructional Material

Representation of Information

X = ( xm xm1..., x2 , x1 x0 . x1 x2 ... x n )r

If xi belongs to S, the value of X will be: Value of X = Val(X) = NOTES

i = n

ri

Now you will learn how to convert a decimal number to any number of radix r. Let a number be of value X in a decimal number system. In order to get its equivalent for a number system of radix r, you need to find all values of xi in the expression: x4 x3 x2 x1 x0 . x1 x2 x3 x4 The integer part of the above expression is calculated by dividing X by r; you get x0 as the remainder. If you keep dividing the previous quotient by r, the subsequent values of xi (i = 1,2,3) are found as the remainders. val(Xint) = x4 x4 + x3 x3 + x2 x2 + x1 x + x0 = (((x4 r + x3)r + x2)r + x1)r + x0 Similarly, the fraction part of X is calculated by multiplying X by r, you get x1 as the integer part of the product. If you keep multiplying the fraction part of the previous product by r, the subsequent values of xi(i = 1,2,3) are found as the integer part of the products. val(Xfrac) = x1 r1 + x2 r2 + x3 r3 + x4 r4 = r1 (x1+ r1(x2+r1(x3+r1 x4))) 1.2.1 Representation of Integers and Fractions 1. Decimal representation The number of digits used to represent decimal number system are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. The radix of decimal numbers is 10. dn1 is the most significant digit. d0 is the least significant digit. Any number is represented as: dn1 . 10

n1

n2

= d i 10i

i=0

n 1

where di is one of the digits from 0 through 9. For example: 35789 = 3 104 + 5 103 + 7 102 + 8 101 + 9 100 475.531 = 4 102 + 7 101 + 5 100 + 5 101 + 3 102 + 1 103

Self-Instructional Material

Representation of Information

2. Binary representation A binary number is represented by digits 0 and 1. The radix of binary numbers is 2. bn1 is the most significant bit. b0 is the least significant bit.

NOTES

i =0 n 1

where bi is the bit 0 or 1. For example: 1001.112 =1 23 +0 22 +0 21 +1 20 +1 21 +1 22 = 1 8 + 0 4 + 0 2 + 1 0 + 1 0.5 + 1 0.25 = 9.7510 Example 1.1: Convert 21.44 from decimal to binary Solution: Integer part Quotient remainder 21/2 10/2 5/2 2/2 1/2 = = = = = 10 1 5 0 2 1 1 0 0 1 Fraction part Integer fraction 0.442 = 0.88 0.882 = 1.76 0.762 = 1.52 0.522 = 1.04 0.042 = 0.08 0.082 = 0.16 0.162 = 0.32 0.322 = 0.64 0.642 = 1.28 The answer is 10101.011100001. A binary numbering system is essentially a binary code in which n bits are used to represent up to 2n distinct combinations of 0s and 1s. 3. Octal representation (base 8 ) An octal number is represented by 0, 1, 2, 3, 4, 5, 6 and 7. The radix of a binary number is 8. On1 is the most significant bit. O0 is the least significant bit.

Self-Instructional Material

Representation of Information

i =0 n 1 i

NOTES

where Oi is an octal digit between 0 to 7. For example: 124.48 = 1 82 + 281+480 + 481 = 164 + 28 + 41 +.5 = 84.510 Conversion between binary and octal is easy because 8 = 23. Three bits correspond to one octal digit. Conversion from binary to octal Example: 1101.101112 = 001 101 . 101 1102 = 15. 568 Conversion from octal to binary Example: 25.348 = 010 101.011 1002 = 10101.0111002 4. Hexadecimal (base 16) notation The 15 digits used to represent a hexadecimal number are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. The radix of a hexadecimal number is 16. hn1 is the most significant bit. h0 is the least significant bit. A hexadecimal number has the general form:

i =0 n 1

where hi is a digit between 0 and 9 or a letter between A and F. For example: 123.816 = 1162 + 2161 + 3160 + 8161 = 1256+ 216 +31 + .5 = 29110 1.2.2 Conversion of Numbers Conversion between binary and hexadecimal is easy because 16 = 24. One hex digit corresponds to four bits. Two hex digits equal a byte (8 bit). For example: D716 = 1101 01112

Self-Instructional Material

Representation of Information

Binary to hexadecimal Example: 1011100.1011 = 0101 1100. 10112 = 5C.B16 Hexadecimal to binary

NOTES

Example: 27.4A16 = 0010 0111 . 0100 1010 2 Example 1.2: Convert the following numbers from the given base to the other three bases listed in the table. Decimal 209.135 ? ? ? Solution: (i) From decimal to binary 205.135 = Integer part: 209/2= 104 104/2 = 52 52/2 = 26 26/2 = 13 13/2 = 6 6/2 3/2 1/2 = 3 = 1 = 0 remainder 1 0 0 0 1 0 1 1 integer part = 0 integer part = 0 integer part = 1 integer part = 0 integer part = 0 integer part = 0 integer part = 1 Binary ? 11010111.11 ? ? Octal ? ? 623.77 ? Hexadecimal ? ? ? 2AC5.D

Fractional part: 0.135 2 = 0.27 0.27 2 = 0.54 0.54 2 = 1.08 0.08 2 = 0.16 0.16 2 = 0.32 0.32 2 = 0.64 0.64 2 = 1.28 225.225 (decimal) = 11010001.0010001 (binary) (ii) From decimal to octal 209.135 =

8

Self-Instructional Material

Integer part: 209/8 = 26 remainder = 1 26/8 = 3/8 = Fractional part: 0.135 8 = 1.08 0.08 8 = 0.64 0.64 8 = 5.12 0.12 8 = 0.96 0.96 8 = 7.68 209.135 (decimal) = 321.10507 (octal) (iii) From decimal to hexadecimal 209.135 = Integer part: 209/16 = 13 13/16 = 0 Fractional part: 0.135 16 = 2.16 0.16 16 = 2.56 0.56 16 = 8.96 209.135 (decimal)= D1.228 (hexadecimal) (iv) From binary to decimal 11010111.11= 1 27+1 26+0 25+1 24+0 23 +1 22 +1 21+1 20+1 21+1 22 = 128 + 64 +16 +4 +2 + 1 +0.5 + 0.25 = 215.75 (v) From binary to octal 11010111.11 = 11010111.11 = 327.6 (vi) From binary to hexadecimal 11010111.11 = 11010111.11 = D 7. C (vii) From octal to decimal 623.77 = 682 + 2 81 + 3 80 + 7 81 + 7 82 = 384 +16 + 3 + 0.875 + 0.1093 = 403.9843 integer part = 2 integer part = 2 integer part = 8 remainder = 1 remainder = 13 (D) integer part = 1 integer part = 0 integer part = 5 integer part = 0 integer part = 7 3 remainder = 2 0 remainder = 3

Representation of Information

NOTES

Self-Instructional Material

Representation of Information

(viii) From octal to hexadecimal 623.77 = 110010011.111 11100 (binary) = 11001 0011.1111 1100 = 193.FC

NOTES

(ix) From hexadecimal to octal 2AC5.D = 0010 1010 1100 0101.1101 = 10101011000101.1101(binary) = 10101 011000 101.110100 = 25305.64 (x) From hexadecimal to decimal 2AC5.D = 2 163 + 10 162 +12 161 +5 160 + 13 161 = 8192 + 2560 + 192 + 5 + 0.8125 = 10949.8125 Summary: Decimal 209.135 215.75 403.9843 10949.8125 Binary 11010001.0010001 11010111.11 110010011.111111 10101011000101.1101 Octal 321.10507 327.6 623.77 25305.64 Hexadecimal D1.228 D7.C 193.FC 2AC5.D

1.2.3 Binary-Coded Number A popular technique to represent any number is to write it in a binary-coded form. Each octal digit represents three binary digits and each hexadecimal number is represented by four binary digits.

Binary-coded octal number

In order to convert a binary form into octal form, you need to divide the binary number in group of three and then corresponding octal digit is assigned to each number as shown in Table 1.1.

Table 1.1 Binary-Coded Octal Numbers

Octal number 0 1 2 3 4 5

Decimal equivalent 0 1 2 3 4 5

Table contd.

10

Self-Instructional Material

6 7 10 11 23 60

110 111 001 000 001 001 010 011 110 000

6 7 8 9 19 48

Representation of Information

NOTES

Similar to octal numbers, you can get binary-coded hexadecimal numbers; the only change is that now binary numbers are grouped in four. The string of hexadecimal digits so obtained represents the binary-coded hexadecimal numbers as shown in Table 1.2.

Table 1.2 Binary-Coded Hexade

Hexadecimal number 0 1 2 3 4 5 6 7 8 9 A B C D E Binary coded hexadecimal 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 Decimal equivalent 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

Table contd.

Self-Instructional Material

11

Representation of Information

F 15 68

15 21 104 244

NOTES

F4

Another popular code, called binary-coded decimal (BCD), can also be used to represent decimal numbers in binary. BCD is an encoding for decimal numbers in which each digit is represented by its binary sequence. Table 1.3 describes the correlation between BCD numbers and decimal numbers.

Table 1.3 Banary-Coded Decimal Number

Decimal BCD number Number 0 1 2 3 4 5 6 7 8 9 10 67 154 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 0001 0000 0110 0111 0001 0101 0100

It is important to understand the difference between conversion of decimal number into binary and binary coding of decimal number. For example, the decimal number 98 is represented by the string of bits 1100010 but when represented in BCD it becomes 1001 1000. For single digits, BCD, is identical to the standard binary code. However, each additional digit in the decimal number requires four additional digits in the BCD representation.

1. How is a number system defined? 2. Give any two characteristics of number systems. 3. How many hex digits is a byte equal to in the hexadecimal system?

12

Self-Instructional Material

In computers, all integers are represented in the binary form. All the normal algorithms for decimal arithmetic also have corresponding versions for binary arithmetic. The arithmetic involving binary numbers has been explained here. For adding two numbers, adder circuit is used : carry input input Output Subtraction borrow input input Output 10 0 1 1101 + 1001 10110 1 01 1 0 0 1 1 0 0 1 0 1 0 1

Representation of Information

NOTES

For multiplying two numbers, the algorithm is simpler, because when you multiply a number by 0 you get zero and when you multiply it by 1, you get the original number. Let us consider the multiplication of two numbers, 1101 with 1011: 1 1 0 1 1 0 1 1 1 1 0 1 1 1 0 1 0 0 0 0 1 1 0 1 1 0 0 0 1 1 1 1 Finally, division is just repeated subtraction as in decimal arithmetic: 0 1 1 10 | 1 1 1 0 1 1 0 0 1 0 0 0 1

You know that representing a decimal number in equivalent binary number is very simple. However, while representing negative integers, the process becomes more complicated. In general, in decimal representation you represent a negative number by using a special sign that indicates whether the number is negative or not. However,

Self-Instructional Material

13

Representation of Information

in case of a binary number, there are varieties of ways that can be used for representing a negative binary number. 1.4.1 Sign-Magnitude Representation

NOTES

The simplest technique of representation is begun by reserving one bit to determine the sign. Usually, the most significant bit (leftmost) in a number is reserved as a sign bit. The 0 in leftmost bit represents a positive number and 1 a negative number. Thus, remaining n1 rightmost bits hold the magnitude of the integer. For example, an 8-bit word 0000 0101 represents +5 and 1000 0101 represents 5. For such a representation scheme, you require two different circuits, one for adding two numbers and another for subtracting two numbers. In order to determine the operation, you need the combination of signs of the two inputs, like subtraction of two opposite signs is basically addition (A(B)= A+B). Depending on the operation, you have to determine which circuit to use. Calculations are done on the absolute values and sign bit is determined using mathematical logic.

Drawbacks of sign-magnitude representation

Addition and subtraction require consideration of both the signs of the numbers involved and their relative magnitude in order to carry out these operations. There are two 8-bit representations of 0, i.e., +0 = 0000 0000 and 0 = 1000 0000. Thus, it become slightly difficult to test zero for both the values as compared to singles representation. 1.4.2 Complement Method Complement methods are used in digital computers for simplifying the subtraction operation and for logical manipulation. There are two types of complements for each base r systems: the rs complement and (r1)s complement. Thus, for binary system, the two types of complement notations are referred to as 2s and 1s complement and for decimal system, it is 10s and 9s complement.

One's complement representation

In one's complement representation, the negative of a number is represented by complementing each bit, i.e., flipping 1 by 0 and vice versa. For example, consider a number 10100110; its one complement will be 01011001. Here also, the leftmost bit is used for storing the sign of the number, positive number is represented by 0 in the leftmost bit and 1 in the leftmost bit represents a negative number. As in case of the sign-magnitude system, the one's complement system also has different representations for +0 and 0, these are 00000000 and 11111111 respectively. The computer calculates the one's complement value of a given number by inverting all its bits, i.e., o replaced by 1 and 1 by 0. Some interesting properties of one's complement representation are as follows:

14

Self-Instructional Material

On negating the negative of a number, you get the original number. This is because the one's complement method is based on bitwise flipping. You can implement one's complement method irrespective of whether the numbers are positive or negative. You are required to add to the number and if there is a carry out of the most significant bit, the carry is added to the least significant bit. For example, consider 110 + (98). In one's complement these numbers will be: 01101110 + (01100010) = 01101110 + 10011101 Addition of these two numbers gives 100001011. The result has a carry, so remove the carry and add it to the least significant bit as follows: 00001011 + 1 = 00001100 The result is 000001100, i.e., 12 which is the actual result of 110 98 which, in turn is the representation for 6. That is also the result of 103 97. Now consider an example where negative result is expected, e.g., 72 + 14. In one's complement, you have: 01001000 + 00001110 = 10110111 + 00001110 Addition result is 11000101. As there is no carry, the output is negative and is stored in 1s complement representation. Thus, the value is 00111010 or (2 + 8 + 16 + 32) = 58. Thus, from these examples, it is clear that you perform subtraction by performing the addition, i.e., adding one's complement of subtractand to the substractor. Thus, subtraction problem is now converted into an addition problem. In order to substract A form B, you should take the one's complement of A, add it to B and then add carry, if any. For example: 112 40. In one's complement, these numbers are: 01110000 + (00101000) = 01110000 + 11010111 The sum of these numbers is 101000111. As there is a carry, add the 9th bit to the least significant bit giving: 01000111 + 1 = 01001000 This represents the value 72, i.e., the result of 112 40. One drawback of ones complement notations is that you cannot perform multiplication using them. You have to check the number before multiplication as only a positive number can be multiplied. If there is negative number then first complement the number and then multiply it with others. The sign of the result depending on whether X or Y or both was negative. If result is negative then complement it again before storing.

Representation of Information

NOTES

Self-Instructional Material

15

Representation of Information

As just discussed, ones complement method has two drawbacks: 1. Two representation of 0 (+ 0 and 0) NOTES 2. Not suitable for multiplication especially when one number is positive and other is negative The twos complement of a number is calculated by inverting the bits (i.e., taking its ones complement) and then adding 1 to it. For example, consider the value 18 which is 00010010 in binary. Inverting the bits, you get 11101101; by adding 1, you get 11101110 which is the twos complement representation of 18. Let us see what happens if you take the twos complement of the same number again . Inverting the bits gives 00010001. Adding 1, you get 00010010, i.e., 18. Thus, by taking twos complement of the twos complement of a number, you get the original number which is same as (18) = 18. Another way to find twos complement is to leave all least significant 0s and the first 1 unchanged, then to complement the remaining bits bit-wise.

For example,

As shown here, the least significant three bits 100 are unchanged. As in ones complement, perform subtraction by performing addition of twos complement numbers without worrying about their signs. For example, X + (Y) = X + (2B Y) = 2B (Y X) = X Y. For example, let us consider 72 + 14. The twos complement of 72 is 10111000. Thus, 10111000 + 00001110 Addition result is 11000110. Neglect the carry. The result is stored in twos complement representation as the output is negative. Thus, value is 00111010 or (2 + 8 + 16 + 32) = 58. Example 1.3: Perform 37545 using twos complement representation. Solution: The steps followed to perform the above operation. 1. Convert the decimal numbers 375 and 42 into signed twos complement binary. 375 375 42 42

16

Self-Instructional Material

2. Now perform the following operation: 37542. 375 = 01 0111 0111 42 = 11 1101 0110 333 = 01 0100 1101 Note that the most significant bit of the result has been discarded. Example 1.4: Use the twos complement method to perform the given subtractions: (a) 11011 1101 (b) 1010 11001 (c) 11010 10000 Solution: (a) 11010 1101 11011 11010 (+ 27) 1101 110011(13) in ( twos complement) 001100(+14) (b) 1010 11001 1010 001010 (+10) 11001 100111 (25) in ( twos complement) 10001 (c) 11010 10010 11010 11010(+26) 10000 10010(-18) 1000 (+8) 1.4.3 Overflow If you have standard n-bit registers to hold data and if two numbers of n digits are added and the sum occupies n+1 digits then an overflow is said to have occurred, as an n-bit register cannot hold on n+1 bit of data. Thus, if n bits are used to represent signed numbers, then the result must be in the range 2n1 to +2n11. If the result does not fit in this range, it implies that an arithmetic overflow has occurred. To ensure correct operation of an arithmetic circuit, it is important to be able to detect the occurrence of overflow. Thus, for n-bit numbers, you have, overflow = Cn1 Cn In case of an overflow, a corresponding flip-flop is set which intimates the user that an overflow has occurred and the output obtained is not correct. An overflow can occur if you add two positive numbers and two negative numbers. It (twos complement) (15 ) in ( twos complement) twos complement of 110001 = 1111

Representation of Information

NOTES

Self-Instructional Material

17

Representation of Information

NOTES

cannot occur if you add one positive and one negative number. Similarly, an overflow can happen during subtraction operation, if one number is positive and other is negative. If two numbers are of the same sign and one is subtracted from another, then overflow cannot take place. An overflow condition can be detected by observing the carry into sign-bit position and the carry out of sign-bit position. If two signs are different, it implies that an overflow has happened. For example, if you add +70 and +80 and 70 and 80, you get 0 1000110 0 10100001 1 0010110 1 0111010 1 0110000 0 1101010

Example 1.5: Solve the following problem and test whether there is an overflow or not: (a) (+66) + (+35); (b) (+66) (90); (c) (36) + (90); (d) (65) (+90) Solution: The steps involved are as following: (i) Convert the decimal numbers to signed binary (ii) Perform the operation with the signed binary numbers (iii) Check the last two carries. (iv) There is an overflow if and only if the two last carries are not equal In decimal notation, an 8-bit number has capacity range from +127 to 128. If the result is beyond this range, it is an overflow state. (a) (+66) + (+35) Carries: 00 +66 +35 +127>+101 0 1000010 0 0100011 0 1100101

Last 2 carries equal Hence, there is no overflow. (b) (+66) -(-90) Carries: 01 +66 90 +127<+156 0 1000010 1 0100110 1 0011110

18

Self-Instructional Material

(c) (36) + (90) Carries: 11 36 90 128<126 Last 2 carries equal Hence, no overflow. (d) (65) (+90) Carries: 10 65 +90 128>155 1 0111111 0 1011010 0 1100101 1 1011100 1 0100110 1 0000010

Representation of Information

NOTES

4. Give any two methods for representing a negative number. 5. How is a negative integer represented according to sign-magnitude method? 6. When is an arithmetic overflow said to have occurred?

As far as integer numbers are considered, fixed-point representation is used for a range of positive and negative integers centred on 0. This is because the radix point (binary point) is fixed and assumed to be the rightmost digit. Thus, if you have an n-bit register, it can represent unsigned integers in the range 0 to 2n 1 and signed integers of the range 2n1 to 2n11. You can use the same representation for storing binary fractional number by scaling the number, it can be implemented in a way that the binary point is implicitly positioned at some other location. Thus, in 8-bit number, you can fix the binary point at fourth position from right, e.g., 11.101 will we represented as 011.1010. However, this approach can represent only a limited number of numbers. Neither very large number can be represented nor can very small fractions be represented with this scheme. Hence, it does not give a precise answer during division. Thus, very large numbers (e.g., 4.6675 1023), very small numbers (e.g., 1027), rational numbers with repeated digits (e.g., 1/3 = 0.333333333333...), irrationals, such as 21/3 and transcendental

Self-Instructional Material

19

Representation of Information

numbers such as e = 2.718..., are also represented in computers for scientific computation. This mode of representation is called floating-point representation because the decimal point is not fixed (as for integers). Floating-point representation is used for representing fractional number in scientific notation. Scientific notation represents numbers in the form of a base number and an exponent. For example, 101.406 could be represented as 1.01406 102. For a hexadecimal representation, the number A24.ECD might be represented as A.24ECD 162. Floating-point employs a sort of sliding window technique in order to scale the number to an appropriate precision. This allows it to represent numbers from a range of 1,000,000,000,000 to 0.0000000000000001 with ease. IEEE Standard 754 is used as the standard for storing floating-point numbers in common computers, including Intel-based PCs, Macintoshes and most UNIX platforms. This standard supports both single- and double-precision FP representations. Scientific notation Scientific notation has the following configuration (Figure 1.1):

Mantissa 6.02 1023 Decimal point Radix (base) Exponent

NOTES

Scientific numbers are usually stored in the normalized form (such that mantissa has exactly one digit to the left of the decimal point, e.g., 2.3425 1019). Binary scientific notation has the following configuration (Figure 1.2):

Mantissa 1.0two 21 Binary point Radix (base) Exponent

1.5.1 Storage Layout IEEE floating-point numbers have three basic components, namely, the sign, the exponent and the mantissa. The normal format for storing Boolean numbers in the scientific notation is: +1.xxxx2 wyyyy2 where xxxx denotes the significand or mantissa, w is the radix i.e., 2 and yyyy denotes the exponent. S denotes the sign of the number. In IEEE 754, the number

20

Self-Instructional Material

of bit allocated to store exponent, significand and sign bit is shown in Figure 1.3 The figure gives a 32-bit representation for FP numbers:

3130 S 1 bit Exponent 8 bits 2322 Significand 23 bits 0

Representation of Information

NOTES

Sign Bit

The sign bit stores one bit where 0 denotes a positive number and 1 denotes a negative number.

Exponent

A number can have both positive as well as negative exponent value. Thus, exponent field should be able to represent both positive and negative exponents. Hence, either use a sign bit for the exponent or add a bias to the actual exponent before storing it; the exponent can only have positive value. For IEEE single-precision floats, this bias value is 127. Thus, if exponent has zero value, it means that 127 is stored in the exponent field. If a stored value is 200, then actual exponent value will be of (200127), i.e., 73. You have to use this notation because the twos complement notation does not work for exponents. The largest negative exponent 11111111in twos complement notation will be stored as 000000012 which is same for positive one. Thus, add a bias term to the exponent to centre the range of exponents on the bias number so that 127 is equated to zero. However, the exponents of 127 (all 0s) and +128 (all 1s) are reserved for special numbers. For double precision, the exponent field is 11 bits and has a bias of 1023.

Mantissa

The mantissa, also known as the significand, represents the precision bits of the number. It is composed of an implicit leading bit, i.e., 1 (the only possible nonzero digit for binary number representation) and the fraction bits. Thus, you can just assume a leading digit of 1with no need to represent it explicitly. As a result, the mantissa has effectively 24 bits of resolution, by way of 23 fraction bits and 52 +1 for double precision. The following points summarize FP storage layout: The sign bit is 0 for positive and 1 for negative. The exponents base is two. The exponent field contains 127 plus the true exponent for single-precision or 1023 plus the true exponent for double precision. The first bit of the mantissa is typically assumed to be 1.f, where f is the field of fraction bits.

Self-Instructional Material

21

Representation of Information

The IEEE 754 representation is thus computed as: FPnumber = (1)S (1 + Significand) 2(Exponent Bias) . Example 1.6: Suppose you have an 8-bit machine. The first bit is reserved for the sign, three bits for the exponent and four for mantissa. What does 01011010 represent? Solution: 0 101 1010 sign exp mantissa Mantissa: 1.1010 Exponent (excess-3 format):5 3=2 (1.1010)2 110.102 = 22 + 21 + 21 + 22 = 4 + 2 + 0.5 = 6.5 Let us see how 10.375 is represented in a 32-bit machine. 10.37510 = 10 + 0.25 + 0.125 = 23 + 21 + 22 + 23 = 1010.011 =1.01001123 Sign: 1 Mantissa: 010011 Exponent (excess 127 format): 3+127 = 130 = (10000010)2 1 10000010 01001100000000000000000 1.5.2 Overflow and Underflow In floating-point representation, the overflow and underflow are slightly different than in integer numbers. Floating-point overflow occurs when a positive exponent has a larger value than the number of bits allotted to it and similarly, underflow occurs when a negative exponent has a large value that cannot be adjusted in the bits allotted to it. This problem can be somewhat reduced by using the doubleprecision number. Here, 64 bits are used for storing the number such that the distribution of bits for exponent, mantissa and sign bit are given in Figure 1.4:

NOTES

22

Self-Instructional Material

2019 Significand 20 bits Significand (contd) 32 bits Figure 1.4 Double Precision Floating-Point Values

Representation of Information

NOTES

Here, two 32-bit words are combined to support an 11-bit signed exponent and a 52-bit significand. This representation is used for storing the double floating-point datatype in C. Thus, the maximum value for finite numbers that can be represented is 2127 for single precision, 21023 for double precision and the mantissa is filled with 1s (including the normalizing 1 bit). This represents the decimal numbers ranging from 2.0 1038 to 2.0 1038. Table 1.4 shows how bits are distributed for single precision (32-bit) and double (64-bit) precision floating-point values. The number of bits allocated to each field and corresponding bit ranges (as represented in square brackets ) is given in the table:

Table 1.4 Distribution of Bits in Single and Double Precisions

Sign Exponent Fraction Bias Single Precision 1 [31] 8 [30-23] 23 [22-00] 127 Double Precision 1 [63] 11 [62-52] 52 [51-00] 1023

Figure 1.5 illustrates specific types of overflow and underflow encountered in standard floating-point representation:

Negative Underflow Expressible Negative Numbers Positive Underflow Expressible Positive Numbers Positive Overflow

Negative Overflow

(12 ) 2

24

128

.52

127

0 .52127

(1224) 2128

As shown in the figure, there are five distinct ranges which cannot be represented by the single-precision floating-point numbers. These are either overflow or underflow condition. The overflow condition occurs if you represent a number with too many values. This is same as the overflow integers. Underflow occurs when the number is too small to be represented. This condition does not arise in case of integers and also, it is a less serious problem because it just denotes a loss of precision, which is guaranteed to be closely approximated by zero and can be somewhat treated by using denormalized representation: Negative overflow: negative numbers having less than (2223) 2127 value

Self-Instructional Material

23

Representation of Information

NOTES

Negative underflow: negative numbers having value greater than 2 149 Zero Positive underflow: positive numbers having value between 0 and 2 149 Positive overflow: positive numbers having value greater than (2223) 2127

Ranges of floating-point numbers

The range of numbers for single-precision floats can be increased by arranging the fields to cover a much broader range. For example, regular 32-bit integers, with all precision centred around zero, can store integers with 32-bits of resolution precisely. Single-precision floating-point, on the other hand, cannot match this resolution with its 24 bits and approximates this value by effectively truncating from the lower end. It provides representation of numbers of much wider range. For example: 11110000 11001100 10101010 00001111 // 32-bit integer = +1.1110000 11001100 10101010 231 // Single-Precision Float = 11110000 11001100 10101010 00000000 // Corresponding Value The range of positive floating-point numbers can be split into normalized numbers (which preserve the full precision of the mantissa) and denormalized numbers (discussed later in the unit) which use only a portion of the fractions precision (Table 1.5).

Table 1.5 Range of Positive Floating Point Numbers

Denormalized

Single precision Double precision Special values 21074 to (1252)21022 2149 to (1223)2-126

Normalized

2126 to (2223)2127 to ~1038.53 21022 to (2252)21023 to ~10308.3

Approximate decimal

~1044.85 ~10323.3

As you know, zero cannot be normalized and the representation of infinity requires some special representation.Thus, IEEE reserves exponent field values of all 0s and all 1s to denote special values in the floating-point scheme. Now, you will see how these special numbers are stored in the IEEE format.

24

Self-Instructional Material

As per IEEE notation, zero mantissa does not represent zero (due to the assumption of a leading 1). Zero is a special value denoted with both exponent and fraction fields. Note that 0 and +0 have different values (because of different values of sign bits), although both represent same number.

Denormalized representation

Representation of Information

NOTES

Denormalized notation is used to overcome the problem of underflow; it provides better precision for smaller number. Here, all exponent bits have 0 value but the fraction is non-zero. The value of a denormalized number does not have an assumed leading 1 before the binary point. The single-precision floating number is represented as a number (1)s 0.f 2126, where s is the sign bit and f is the fraction and double precision; denormalized numbers are represented as (1)s 0.f 2-1022.

Infinity

An exponent of all 1s together with the fraction of zero, represents infinity. Like zero there is +infinity and infinity differentiated by the sign bit. The representation of infinity gives the program a choice to present overflow condition as an error or carry infinity value.

Not a Number

The value NaN (Not a Number) is used to represent a value that does not represent a real number and is used to signal various exception conditions. Some of the undefined arithmetic operations involving real numbers are taking the square root of a negative number or dividing any number by zero. These results are called NaNs and are represented with an exponent of 255 and a zero significand. These exception conditions are generated with some mathematical operations given in Table 1.6. There are two categories of NaN: QNaN (Quiet NaN) and SNaN (Signalling NaN). A QNaN is an NaN with the most significant fraction bit set. A QNaN is obtained as a result of indeterminate operations, i.e., it is the output of an operation in which the result is not mathematically defined. An SNaN is an NaN with the most significant fraction bit clear. It is used to signal an exception in case of invalid operations. NaNs can help with debugging, but they contaminate calculations (e.g., NaN + x = NaN). Table 1.6 represents the various numbers in IEEE format.

Self-Instructional Material

25

Representation of Information

Value +0 Positive Denormalized Real 0.f 2(b+1) Positive Normalized Real 1.f 2(eb) +Infinity SNaN

NOTES

0 0

00..00 00..01 : 11..11 XX..XX 00..00 00..01 : 01..11 10..00 : 11..11 00..00 00..01 : 11..11 XX..XX 00..00 00..01 : 01..11 10..00 : 11.11

0 0 0

0 1 1

QNaN 0 Negative Denormalized Real 0.f 2(b+1) Negative Normalized Real 1.f 2(eb) Infinity SNaN

1 1 1

11..11

QNaN

Special operations

Operations on special numbers are well defined by IEEE and shown in Table 1.7. In the simplest case, any operation with a NaN yields a NaN result. Other operations are as follows:

26

Self-Instructional Material

Representation of Information

Operation n Infinity Infinity Infinity nonzero 0 Infinity + Infinity 0 0 Infinity - Infinity Infinity Infinity Infinity 0

NOTES

Floating-point computation

Performing floating-point arithmetic operations like addition and subtraction is more complicated as each floating-point number has mantissa and exponents. It is possible that two numbers on which operation has to be performed have different exponent values hence you cannot just add the mantissa of the two numbers as in case of integers. To implement addition or subtraction operations, you need to perform the following steps: Check for zero as floating-point zero cannot be normalized. Align the mantissa by shifting one of the operands so that the exponents of both numbers become equal. Now perform the desired (add or subtract) operation on the mantissa and get the resultant mantissa. The resultant significant may not be normalized, hence it is required that you shift the resultant mantissa and update the exponent value E so that the output is in normalized form. To implement multiplication or division operations, you need to perform the following steps: Check for zero as floating-point zero cannot be normalized. Add the exponent in case of multiplication and subtract the exponent in case of division. Multiply or divide the mantissa depending upon the operation to be performed. The resultant significant may not be normalized, hence it is required that you shift the resultant mantissa and update the exponent value E such that the output is in normalized form. Decimal-to-binary floating-point conversion is found difficult if the decimal number has repeated digits (e.g., 0.33333), as illustrated here:

Self-Instructional Material

27

Representation of Information

3 . 3 3 3 3 3 3...

0.33333333 x2 0. 66666666 0.66666666 x2 1. 33333332 0.33333332 x2 0 66666664

NOTES

11 . 0 1 0 1 0 1 0.. . => 1.10101010.. x21 Here, the significand is 101 0101 0101 0101 0101 0101, the sign is negative (representation = 1), and the exponent is computed as 1 + 127 = 12810 = 1000 00002. This yields the following representation in IEEE 754 standard notation:

1 1000 0000 101 0101 0101 0101 0101 0101

In this case, it can be easily seen that you have to truncate the mantissa to some approximation. If you apply the mathematical operations to real numbers, some error will occur as floating point representation is only an approximation to a real number. In the following example, it can be easily seen that the floating-point addition and subtraction are not associative. For the sake of simplicity, let us use decimal numbers. Let x = 1.45 1038,

y = 1.45 1038, z = 2.0.

x + (y + z) = 1.45 1038 + (1.45 1038 + 2.0) = 0.0

and (x + y) + z = (1.45 1038 + 1.45 1038) + 2.0 = 2.0 The difference occurs because in the first case, value 2.0 in floating-point representation cannot be distinguished in the mantissa of 1.45 1038 . This is because of the lack of precision (number of digits) of the mantissa in the floatingpoint representation.

7. Why is the floating-point representation called so? 8. What is the IEEE bias value for single-precision floats? 9. What does NaN represent in the context of floating-point numbers?

28

Self-Instructional Material

Many applications of digital computer require handling of data consisting of not only numbers but also letters of alphabet and special characters that are used for text and other data processing. Similar to decimal numbers, alphabetic characters and symbols must also be coded in binary as well. To store character information, usually 1 byte is used. Two widely used coding schemes based on the binary system are American Standard Code for Information Interchange (ASCII) and the Extended Binary Coded Decimal Interchange Code (EBCDIC). The ASCII data-coding scheme is used on many personal computers and various mid-size servers. The EBCDIC coding scheme is used mainly on large servers and mainframe computer. ASCII was developed by ANSI (American National Standards Institute). ASCII is a 7-bit code; thus, it is possible to represent 128 alphanumeric characters set base which includes 10 decimal digits, characters based on English alphabet which include the 26 letters of alphabets and a number of special characters like $, %, +, =, etc. Out of 128 character codes, first 32 are control codes (non-printable); the remaining 96 character codes are representable characters as given in Table 1.8. Many programming languages, including Assembly and C, require/allow programmers to directly manipulate characters using their ASCII values. Coding schemes such as ASCII and EBCDIC make it possible for users to interact with a computer.

Table 1.8 ASCII Character Codes

ASCII Hex Symbol ASCII Hex Symbol 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 A B C D E F NUL SOH STX ETX EOT ENQ ACK BEL BS TAB LF VT FF CR SO SI 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US ASCII Hex Symbol 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F (space) ! " # $ % & ' ( ) * + , . / ASCII Hex Symbol 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0 1 2 3 4 5 6 7 8 9 : ; < = > ?

Representation of Information

NOTES

(Contd.)

Self-Instructional Material

29

Representation of Information

ASCII Hex Symbol 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F @ A B C D E F G H I J K L M N O ASCII Hex Symbol 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F P Q R S T U V W X Y Z [ \ ] ^ _ ASCII Hex Symbol 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F ` a b c d e f g h i j k l m n o ASCII Hex Symbol 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F p q r s t u v w x y z { | } ~

NOTES

For example, the letter a is assigned 97 in the ASCII table. Expressed in binary, that is 26 + 25+ 20 (64 + 32+ 1). So, the byte that represents a is:

128 0 64 1 32 1 16 0 8 0 4 0 2 0 1 1 = 97

The current architecture of the system include 8 bit, i.e., 1 byte, which can represent 256 different values. In addition to 128 standard ASCII codes, there are other 128 that are known as extended ASCII. An extended character set is obtained by setting the most significant bit (MSB) to 1 (codes 80h to FFh) so that each character is stored in 1 byte. Hence, there is more than one extended ASCII character set. These codes are platform and locale dependent. This part of the code depends on the OS used. For example, in case of Windows, you can express accentuated characters, Greek symbols, etc.; some graphic characters are also expressed using extended ASCII representation. EBCDIC (Extended Binary Coded Decimal Interchange Code) is a character encoding set developed by IBM in 1963 to be used in IBM mainframe computers. EBCDIC offers a wider range of control characters than ASCII. The character encoding in EBCDIC is based on binary-coded decimal (BCD), which has already been discussed in this unit. This ensured easy data sharing between computers with the help of punch cards. This type of character coding also makes use of all 8 bits that make up 1 byte. A byte is categorized into two nibbles, consisting of 4 bits each. The first nibble, representing the class of the character, is called zone, while the second nibble, defining the specific character inside the class, is known as digit. For instance, a first nibble of 1111 implies that the character is a number, while the second nibble will define the encoded number. In EBCDIC, the contiguous characters in the alphanumeric range are categorized in the form of blocks. There are four main blocks that are used in the EBCDIC code page that are reserved for different characters. For instance, 0000

30

Self-Instructional Material

0000 to 0011 1111 are for control characters; 0100 0000 to 0111 1111 are for punctuation; 1000 0000 to 1011 1111 for lowercase characters and 1100 0000 to 1111 1111 for uppercase characters and numbers. Non-alphanumeric characters, on the other hand, are mostly outside the BCD range. The most common EBCDIC tables has been given in Table 1.9:

Table 1.9 EBCDIC Table

Representation of Information

NOTES

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

Hexadecimal 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19

NUL SOH STX ETX PF HT LC DEL

EBCDIC Null Start of Header Start of Text End of Text Punch Off Horizontal Tab Lower Case Delete

Start of Manual Message Vertical Tabulation Form Feed Carriage Return Shift Out Shift In Data Link Escape Device Control 1 Device Control 2 Tape Mark Restore New Line Backspace Idle Cancel End of Medium Cursor Control Customer Use 1

(Contd.)

Self-Instructional Material

1A CC 1B CU1

31

Representation of Information

Decimal 28 29

IRS IUS DS SOS FS BYP LF ETB ESC

EBCDIC Interchange File Separator Interchange Group Separator Interchange Record Separator Interchange Unit Separator Digit Select Start of Significance Field Separator Bypass Line Feed End of Transmission Block Escape

NOTES

30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61

SYN PN RS UC EOT

(Contd.)

32

Self-Instructional Material

Decimal 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95

Hexadecimal 3E 3F SUB 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F

SP

Representation of Information

NOTES

. < ( + &

! $ * ) ;

(Contd.)

Self-Instructional Material

33

Representation of Information

Decimal 96 97

Hexadecimal 60 61 / 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 80 81

NOTES

98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129

| , % _ > ?

: # @ = a

(Contd.)

34

Self-Instructional Material

Decimal 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163

Hexadecimal 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3

b c d e f g h i

Representation of Information

NOTES

j k l m n o p q r

~ s t

(Contd.)

Self-Instructional Material

35

Representation of Information

Hexadecimal A4 u A5 v A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2

w x y z

NOTES

166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196

Grave Accent

{ A B

(Contd.)

C3 C C4 D

36

Self-Instructional Material

Decimal 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229

Hexadecimal C5 E C6 F C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3

G H I

Representation of Information

NOTES

} J K L M N O P Q R

Closing Brace Uppercase J Uppercase K Uppercase L Uppercase M Uppercase N Uppercase O Uppercase P Uppercase Q Uppercase R

\ S T

(Contd.)

Self-Instructional Material

E4 U E5 V

37

Representation of Information

Hexadecimal E6 W E7 X E8 Y E9 Z EA EB EC ED EE EF F0 0 F1 1 F2 2 F3 3 F4 4 F5 5 F6 6 F7 7 F8 8 F9 9 FA FB FC FD FE FF

NOTES

232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255

Zero One Two Three Four Five Six Seven Eight Nine

10. What are the two most widely used coding schemes based on binary system? 11. How many control codes are there in the ASCII coding?

38

Self-Instructional Material

1.7 SUMMARY

In this unit, you learnt that:

Machine language makes use of binary numbers, 0 and 1, to store and read data. The common number systems used for representing numbers are binary, decimal, hexadecimal and octal systems. Binary-coded decimal (BCD) is a popular method of representing decimal numbers into binary numbers. The conversion of numbers into binary and the binary coding of numbers are two different concepts that yield different results. Complement methods are used in digital computers for simplifying the subtraction operation and for logical manipulation. In ones complement method, the negative of a number is represented by complementing each bit. The twos complement method is not suitable for the multiplication of a negative and a positive number. In case of an overflow, a corresponding flip-flop is set which intimates the users that an overflow has occurred and the output is not correct. The mantissa represents the precision bits of a number. A QNaN is an NaN with the most significant fraction bit set. An SNaN is an NaN with the most significant fraction bit clear. The ASCII coding was developed by the American National standards Institute. EBCDIC coding was developed by IBM in 1963.

Representation of Information

NOTES

Decimal number system: It refers to a numeral system which has ten as its base. Binary-coded decimal: It is an encoding for decimal numbers in which each digit is represented by its own binary sequence. Extended ASCII: It refers to a coding scheme that includes extra 128 codes in addition to the standard 128 ASCII codes. Underflow: It refers to the problem encountered in the case of floating numbers when a negative exponent has a large value and cannot be adjusted in the bits allotted to it. Octal number system: It refers to the number system with a radix of 8.

Self-Instructional Material

39

Representation of Information

1. A number system is defined according to its base or radix.

NOTES

2. Two characteristics of number systems are: (i) Base is equal to the number of digits in the system. (ii) The largest possible value of digit is one less then the radix. 3. In the hexadecimal system, a byte is equal to two hex digits. 4. Two methods used for representing a negative number are: (i) Sign-magnitude method (ii) Complement method 5. According to the sign-magnitude method, a negative integer is represented by reserving one bit to determine the sign of the integer. 6. When data is large and does not fit into the allotted bits, an arithmetic overflow is said to have occurred. 7. The floating-point representation is called so because the decimal point in fractional numbers is not fixed. 8. The IEEE bias value for single-precision floats is 127. 9. In the context of floating-point numbers, the value NaN (Not a Number) is used to represent a value that does not represent a real number. 10. The two most widely used coding schemes based on the binary system are ASCII and EBCDIC. 11. There are 32 control codes in the ASCII coding.

Short-Answer Questions

1. What do you understand by number systems? 2. How would you represent a number in decimal and hexadecinal number systems? 3. Write a short note on the binary-coded numbers. 4. What are the two methods of representing negative integers in the binary number system? 5. Write a short note on the ASCII character coding.

40

Self-Instructional Material

Long-Answer Questions

Representation of Information

1. Explain the process of conversion of numbers from one number system into another. 2. How can you represent NaN in the context of floating-point numbers? 3. Explain why binary number system is used in computers. 4. Discuss the advantages and disadvantages of the ones complement and twos complement methods.

NOTES

Self-Instructional Material

41

- HW-1Uploaded bytneshoe
- 015itmsc31Uploaded bynandanvr
- CS2202_DPSD (Internal Test-2)Uploaded byPrakash Venu
- an083_01Uploaded byJackzid
- SPUploaded byfjohny
- SAPScript System SymbolUploaded bysmgolf
- 49053182 Matlab ManualUploaded byElvis Ramos Callupe
- Matlab tutoriumUploaded byNaina
- Design of Vedic Multiplier for Digital Signal Processing ApplicationsUploaded byseventhsensegroup
- Adder Sub AluUploaded byBasheer V.P
- Alarm & Hardware InvestigationUploaded bygfrghhhyrdd
- L8-L9-Fixed Point Arithmetic MdfdUploaded byPritam Das
- Ch 7 Numerical ControlUploaded byJapneet Ghai
- Badass Tutorial Unit 6 Adders SubtractorsUploaded bydjpsychoscientz
- Mcq Computer HardwareUploaded byasadkhanss
- Hybrid Fp Fxp Dot ProductUploaded byZohaib Gilani
- Core Web Application Development With PHP and MySQL - Part 1 & 2Uploaded byAmber Healley

- Chapter 1Uploaded bybassdude51
- Gestar II Mat AAA4 AlunoUploaded byjuze mário
- Problemas de Sistema de UnidadesUploaded byEly Vásquez
- CONTROL ED MATEMATICA 3er Nivel A martes 7.docxUploaded byJuan Patricio Flores Vidal
- cuaderno_2eso.pdfUploaded byRoberto Fernandez
- Diversificacion II C+T - Ud01Uploaded byConchi Merino Contreras
- CONVERSION_UNIDADES.pdfUploaded byJosé Tinoco
- temas sueltos de matemáticasUploaded byLeonardo Sáenz Baez
- Nivelamento_aula_01__potenciacao_e_unidades_2017_1Uploaded byVictor Tavares
- La notación científica.docUploaded bySusan Castellano
- Module 1 Integral Exponents (1)Uploaded bySucceed Review
- fisica.pdfUploaded byMarisol Carrillo
- Laws of IndicesUploaded byLi Ann Chung
- Física Clasica MecanicaUploaded byencontradomp
- Acces-practicas de Bases de Datos AccessUploaded bymadsori
- Algarismos significativosUploaded bycastelo_grande
- NUMBER Types of Data and Stored in OracleUploaded byhacto45
- MATEMATICAS PARA CATV MOD 1Uploaded byJesus Leos Vargas
- GU%C3%8DA0Uploaded byAlicia Contreras
- 978 85 8482 228 7 Calculo Numerico LivroUploaded byguigui17
- Propuesta de planificación de unidad de enseñanza y aprendizaje pruebaUploaded byAntonio Duran
- probabilidad_y_estadisticaUploaded bydgp2667
- 10 step lesson planUploaded byapi-325889338
- Analisis Reticular de Segundo Grado SecundariaUploaded byBraulio Daniel Rincon Blas
- Introducing MathematicsUploaded byAmanda Garcia
- Plan de Area Matematica 8 2015Uploaded byRaul Armando Chamorro Benitez
- Maq Clase 1 Unidades Pot Analisis Dim Cifras SigUploaded byric1284
- El Hombre Anumerico-John Allen PaulosUploaded byDaniel Santacruz L
- representacion numericaUploaded byRubén López Lema
- INSTITUCIÓN EDUCATIVA-practica 5°.docxUploaded byNatividad Ordoño Alca