Number Systems CHAPTER Positional Number Systems

Size: px
Start display at page:

Transcription

1 CHAPTER 2 Number Systems Inside computers, information is encoded as patterns of bits because it is easy to construct electronic circuits that exhibit the two alternative states, 0 and 1. The meaning of bits depends on the interpretation. Since the information is processed by the computer essentially in some numerical form, we explore the ways how a computer represent numeric data internally in this chapter. 2.1 Positional Number Systems A number system is a system of representing numbers. It is defined by a set of basic symbols called digits or numerals, and the ways in which the digits can be combined to represent the numbers in the system. A number system can represent integers, fractions, or mixed numbers. A mixed number has two parts: an integer part that tells you the whole and a fraction part that is less than one whole. A radix point separates the integer part and the fraction part. Since the decimal number system is the most familiar number system and used in our everyday life, our discussion begins with it. The decimal number system is a positional number system. In a positional number system, a number is represented by a string of digits. The value of each digit in the string is determined by the position it occupies in the number. That is, each digit position has a weight associated with it. The rightmost position in the number has the lowest weight. The leftmost digit in the number is called the most significant digit (MSD) and the rightmost digit is called the least significant digit (LSD). Other examples of commonly used positional number systems include binary, octal, and hexadecimal number systems. In the decimal number system, there are 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. The decimal number of the form d p 1 d p 2...d 1 d 0.d 1 d 2...d n has the 15

2 16 Number Systems Name Base Digits Binary Octal Decimal Hexadecimal 2 0, 1 8 0, 1, 2, 3, 4, 5, 6, , 1, 2, 3, 4, 5, 6, 7, 8, , 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Table 2.1: Commonly used number systems with their bases and digit sets. value, Xp 1 i= n d i 10 i All the weights in the decimal system are powers of the number 10. The integer and fraction parts are separated by the. symbol, the decimal point. The fraction part is denoted by a sequence of digits whose weights are negative powers of 10. The decimal number system is also known as the base-10 number system because the weight of each position in the number is a power of 10. For example, the decimal number can be decomposed as follows: = When we replace the base 10 with some other whole number r, called the base or radix, then we have base-r number system. This number system requires r distinct digits, and the weight in position i is r i. Thus, the base-r number of the form x p 1 x p 2...x 1 x 0.x 1 x 2...x n has the value, Xp 1 i= n x i r i where each x i comes from the set of r distinct digits. Traditionally, the first r decimal digits serve as the digits for the base-r systems when r apple 10. When r>10, the first r 10 uppercase letters of the alphabet are used to provide additional symbols. For example, the three-digit number 101 denotes five in the binary number system whereas it denotes one hundred and one in the decimal system. When the base of a base-r number N is unclear from the context, we append a subscript r to it. For example, represent a binary number 101. Table 2.1 shows the bases and digit sets for some commonly used number systems. 2.2 Scientific Notation Scientific notation is a scheme of representing decimal numbers that are very small or vary large. In scientific notation, a number is represented in the form: x 10 y

4 18 Number Systems Binary Octal Hexadecimal Decimal A B C D E F 15 Table 2.2: The correspondence between 4-bit binary, octal, hexadecimal, and decimal numbers = =5.125 Similar to the decimal number system, the leftmost bit b p 1 is called the most significant bit (MSB) and the rightmost bit b n is called the least significant bit (LSB). The radix point in the binary number system is referred to as the binary point. The octal number system is useful for representing multi-bit binary numbers. Since eight is a power of two (8 = 2 3 ), three bits in a binary number can be uniquely represented with a single octal digit. For example, = = = = Similarly, the hexadecimal number system is also useful for representing multi-bit binary numbers. Each group of four bits in a binary number can be uniquely represented by a single hexadecimal digit. For example, = =8CE = =2.B2C 16 Table 2.2 shows the correspondence between 4-bit binary, octal, hexadecimal, and decimal numbers.

5 2.4 Number System Conversion 19 Let N be the decimal number and bn-1bn-2 b0 be the binary number after the conversion. 1. Set i to Divide N by 2 and obtain a quotient and a remainder. 3. Set bi to the remainder and N to the quotient. 4. If N is not zero, set i to i+1 and go to step 2. Figure 2.1: A decimal to binary conversion algorithm for an integer. i N b i 0 108/2 = 54 0 (LSB) 1 54/2 = /2 = /2 = /2 = /2 = /2 =0 1 (MSB) Figure 2.2: Converting to binary. A binary number system using n bits can represent 2 n di erent numbers. When such a fixed precision binary number is used to represent only positive values, it is called an unsigned number. It is also possible to encode signed numbers (positive numbers and negative numbers) in binary. There are several ways to represent the signed numbers in binary. One way of representing a negative number is setting the MSB to 1 and using the remaining bits to represent the value. In this case, the MSB is referred to as the sign bit. However, to keep the computer hardware implementation as simple as possible, almost all today s computers internally use twos complement representation. 2.4 Number System Conversion Since humans typically use decimal numbers, but computers use binary numbers internally, it is important to know how to convert decimal numbers to binary numbers and vice versa. An integer N can be converted from decimal form to binary form by repeatedly dividing N by two and using the remainders. Figure 2.1 shows an algorithm for such a conversion. For example, a positive integer is converted to the binary number The conversion process that follows the algorithm described in Figure 2.1 is illustrated in Figure 2.2.

6 20 Number Systems Let N be the decimal fraction and b-1b-2 b-n be the binary number after the conversion. 1. Set i to Multiply N by 2 and set N to the result. 3. If N is less than 1, set b-i to Otherwise, set b-i to 1 and N to N If i is less than n, set i to i+1 and go to step 2. Figure 2.3: A decimal to binary conversion algorithm for fractions. i N b i = = = = Figure 2.4: Converting to a 4-bit binary fraction. For a mixed number, we convert its integer part and fraction part to binary form separately. Then, we combine the results. An algorithm for converting a decimal fraction to binary form is shown in Figure 2.3. To obtain the first n bits of a binary fraction using the algorithm, it is required to perform n multiplications by two in general. For example, the process of converting a decimal fraction to a 4-bit binary fraction is illustrated in Figure 2.4. After combining the results from the integer conversion and the fraction conversion, a mixed number in the above examples is converted to a binary number However, the 4-bit binary fraction obtained in the process of Figure 2.4 is inexact. So far, we assumed that there are as many bits available as required to represent the number, and we did not consider the size of the representation. When the number of bits used is specified to represent a number, it determines the range of possible numbers that can be represented. For example, 8 bits can represent 256 = 2 8 distinct numeric values. Word is a group of bits that are handled as a unit by the computer. The number of bits in a word is an important characteristic of a computer architecture. The precision of expressing a numerical quantity strongly depends on the word size (i.e., the number of bits in a word). If the word size is only four bits, then we can not express the result of the above example more precisely. A dyadic fraction is a rational number whose denominator is a power of two;

8 22 Number Systems 2.5 Unsigned Binary Arithmetic Arithmetic operations performed on unsigned binary numbers are much like arithmetic in the decimal number system that we know very well. Addition, subtraction, multiplication, and division can be performed on binary numbers. A pair of unsigned binary numbers can be added bit by bit according to the same method used in decimal addition. Since computers use di erent standard to encode a mixed number (typically using the IEEE 754 standard), we will restrict our discussion to unsigned whole numbers. For example, a pair of unsigned 4-bit binary numbers 1001 and 0101 can be added as follows: carry When adding two 1s in the same column produces 10 2, 1 (called carry) will have to be added to the left column of more significant bits. When the result of addition exceeds one, we carry the excess amount to the next position using a carry. The position has a weight that is higher by a factor equal to two. An overflow occurs when a computation produces a value that falls outside the range of values that can be represented. For example, adding two unsigned 4-bit binary numbers 1011 and 0111 produces a 5-bit value 10010, and it is an overflow: carry The carry bit from the MSB tell us that an overflow occurred in the addition. Unsigned binary subtraction works in much the same way as decimal subtraction. For example, 0101 can be subtracted from 1001 produces 0100 as follows: borrow Subtracting a 1 from a 0 in a column produces 1 by borrowing 1 (called borrow) from the left column of more significant bits. When the result of a bit by bit subtraction in a column is less than 0, we borrow 1 from the column on the left subtracting it from the next higher positional value. Unsigned binary multiplication is also similar to the decimal multiplication that adds up partial products to produce the final result. For example, two

9 2.6 Ones Complement Representation 23 Positive Negative Ones complement Decimal Ones complement Decimal Table 2.3: 4-bit ones complement representation. 4-bit unsigned binary numbers 1001 and 0101 are multiplied as follows: Note that the result can not be represented with 4 bits. In general, an n-bit binary multiplication requires 2 n bits to represent the result. Unsigned binary division is again similar to the decimal division. For example, the process of dividing by 0100 produces a quotient 111 and a remainder ) Ones Complement Representation Ones complement representation is one of the methods to represent a negative number. The ones complement of a negative binary number is the bitwise inversion (flipping 0 s for 1 s and vice-versa) of its positive counterpart. For example, the ones complement representation of 6( ) is The maximum value that can be represented by the ones complement representation with n bits is 2 n 1 1 and the minimum is 2 n 1 1. Table 2.3 shows

11 2.8 Shift Operations and Sign Extension 25 Positive Two s complement Decimal Negative Two s complement Decimal Table 2.4: 4-bit two s complement representation. 1. Add the two operands including the sign bits. 2. If the carry into the MSB is not equal to the carry out of the MSB, an overflow has occurred. Figure 2.7: Overflow detection in two s complement addition. Overflow occurs if n + 1 bits are required to contain the result from an n-bit addition or subtraction. If the sign bits were the same for both numbers and the sign of the result is di erent to them, an overflow has occurred. The process of detecting an overflow after adding two operands is shown in Figure 2.7. For example, an overflow occurs in the following 4-bit two s complement addition: carry (7) (7) In this case, the carry into the MSB (1) is di erent to the carry (0) out of the MSB. 2.8 Shift Operations and Sign Extension A shift operation shifts all of the bits in its operand. Every bit in its operand is moved a given number of positions to a specified direction. There two di erent types of shift operations: logical shift and arithmetic shift. A logical shift operation moves bits to the left or right. The bits that fall o at the end of the word are discarded. The vacant positions in the opposite

12 26 Number Systems x>>3 x<<3 Logical shift Arithmetic shift Figure 2.8: The di erence between 8-bit logical shift and arithmetic shift for x = w bits w+k bits (a) Decimal 4-bit 8-bit (b) Figure 2.9: (a) The sign extension process. (b) The sign-bit repetition for -6. end are filled with 0s. The arithmetic left shift is the same as the logical left shift. In the arithmetic right shift, the leftmost bits are filled with the sign bit of the original number. We denote a left shift operation with << and right shift operation with >>. Figure 2.8 shows an example of the di erence between logical shift and arithmetic shift for x = Using shift operations, we can e ciently perform unsigned multiplication or division by powers of two. An n-bit logical left shift operation on unsigned integers is equivalent to multiplication by 2 n. For example, (13) << 2 = = (52) An n-bit logical right shift is equivalent to division by 2 n, and we obtain the quotient of the division. For example, (53) >> 2 = = (13) Using arithmetic shifts, we can e ciently perform multiplication or division of signed integers by powers of two. In two s complement representation, arithmetic shift operations extend the notion of the floor operation. The floor of an integer x (denoted by bxc) is defined by the greatest integer less than or equal to x. For example, b11/2c = 5 and b 3/2c = 2. An arithmetic shift operation on an integer takes the floor of the result of multiplication or division. For example, ( 4) << 1 = ( 6) ( 4) >> 1 = ( 2) ( 4) >> 2 = ( 1) ( 4) << 2 = (0) Overflow (4) << 1 = ( 8) Overflow

13 2.8 Shift Operations and Sign Extension 27 However, in two s complement representation, an arithmetic right shift is not equivalent to division by a power of two. For example, when you perform an arithmetic right shift on a 4-bit 1 = , you still get 1 = The ANSI C99 standard does not specify the definition of the C language s right shift operator for negative values. The behavior of the right shift operator depends on the C compiler. When converting an integer with w bits into the one with w + k bits and the same value, we need to perform sign extension in two s complement representation. The MSB (the sign bit) must be repeated in all the k extra bits. Figure 2.9(a) shows this process and Figure 2.9(b).

Number System. Introduction. Decimal Numbers

Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26

CHW 261: Logic Design

CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER

Module 2: Computer Arithmetic

Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

Digital Fundamentals

Digital Fundamentals Tenth Edition Floyd Chapter 2 2009 Pearson Education, Upper 2008 Pearson Saddle River, Education NJ 07458. All Rights Reserved Decimal Numbers The position of each digit in a weighted

MACHINE LEVEL REPRESENTATION OF DATA

MACHINE LEVEL REPRESENTATION OF DATA CHAPTER 2 1 Objectives Understand how integers and fractional numbers are represented in binary Explore the relationship between decimal number system and number systems

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:

Number representations

Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Base-two, or

Chapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude

Chapter 2 Positional number systems A positional number system represents numeric values as sequences of one or more digits. Each digit in the representation is weighted according to its position in the

Divide: Paper & Pencil

Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

CHAPTER V-1 CHAPTER V CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-2 NUMBER SYSTEMS RADIX-R REPRESENTATION Decimal number expansion 73625 10 = ( 7 10 4 ) + ( 3 10 3 ) + ( 6 10 2 ) + ( 2 10 1 ) +(

Chapter 2. Data Representation in Computer Systems

Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting

COMP Overview of Tutorial #2

COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,

Number Systems. Both numbers are positive

Number Systems Range of Numbers and Overflow When arithmetic operation such as Addition, Subtraction, Multiplication and Division are performed on numbers the results generated may exceed the range of

Chapter 2: Number Systems

Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many

TOPIC: NUMBER SYSTEMS

Ministry of Secondary Education Progressive Comprehensive High School PCHS Mankon Bamenda Department of Computer Studies Republic of Cameroon Peace Work - Fatherland TOPIC: NUMBER SYSTEMS Class: Comp.

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

UNIT I Digital Systems: Binary Numbers, Octal, Hexa Decimal and other base numbers, Number base conversions, complements, signed binary numbers, Floating point number representation, binary codes, error

Internal Data Representation

Appendices This part consists of seven appendices, which provide a wealth of reference material. Appendix A primarily discusses the number systems and their internal representation. Appendix B gives information

CS 101: Computer Programming and Utilization

CS 101: Computer Programming and Utilization Jul-Nov 2017 Umesh Bellur (cs101@cse.iitb.ac.in) Lecture 3: Number Representa.ons Representing Numbers Digital Circuits can store and manipulate 0 s and 1 s.

Chapter 1 Review of Number Systems

1.1 Introduction Chapter 1 Review of Number Systems Before the inception of digital computers, the only number system that was in common use is the decimal number system which has a total of 10 digits

CO212 Lecture 10: Arithmetic & Logical Unit

CO212 Lecture 10: Arithmetic & Logical Unit Shobhanjana Kalita, Dept. of CSE, Tezpur University Slides courtesy: Computer Architecture and Organization, 9 th Ed, W. Stallings Integer Representation For

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems

Bits, Words, and Integers

Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are

BINARY SYSTEM. Binary system is used in digital systems because it is:

CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System

CHAPTER 2 Number Systems

CHAPTER 2 Number Systems Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish between non-positional and positional number systems.

Signed umbers. Sign/Magnitude otation

Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,

CS & IT Conversions. Magnitude 10,000 1,

CS & IT Conversions There are several number systems that you will use when working with computers. These include decimal, binary, octal, and hexadecimal. Knowing how to convert between these number systems

2 Number Systems 2.1. Foundations of Computer Science Cengage Learning

2 Number Systems 2.1 Foundations of Computer Science Cengage Learning 2.2 Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish between

±M R ±E, S M CHARACTERISTIC MANTISSA 1 k j

ENEE 350 c C. B. Silio, Jan., 2010 FLOATING POINT REPRESENTATIONS It is assumed that the student is familiar with the discussion in Appendix B of the text by A. Tanenbaum, Structured Computer Organization,

CHAPTER TWO. Data Representation ( M.MORRIS MANO COMPUTER SYSTEM ARCHITECTURE THIRD EDITION ) IN THIS CHAPTER

1 CHAPTER TWO Data Representation ( M.MORRIS MANO COMPUTER SYSTEM ARCHITECTURE THIRD EDITION ) IN THIS CHAPTER 2-1 Data Types 2-2 Complements 2-3 Fixed-Point Representation 2-4 Floating-Point Representation

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Data Representation ti and Arithmetic for Computers Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Questions What do you know about

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Data Representation II CMSC 313 Sections 01, 02 The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the high-order bit

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

Contents Number systems and conversion Binary arithmetic Representation of negative numbers Addition of two s complement numbers Addition of one s complement numbers Binary s Readings Unit.~. UNIT NUMBER

Digital Fundamentals

Digital Fundamentals Tenth Edition Floyd Chapter 1 Modified by Yuttapong Jiraraksopakun Floyd, Digital Fundamentals, 10 th 2008 Pearson Education ENE, KMUTT ed 2009 Analog Quantities Most natural quantities

CHAPTER 1 Numerical Representation

CHAPTER 1 Numerical Representation To process a signal digitally, it must be represented in a digital format. This point may seem obvious, but it turns out that there are a number of different ways to

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose

Introduction to Computers and Programming. Numeric Values

Introduction to Computers and Programming Prof. I. K. Lundqvist Lecture 5 Reading: B pp. 47-71 Sept 1 003 Numeric Values Storing the value of 5 10 using ASCII: 00110010 00110101 Binary notation: 00000000

UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES

UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES Structure 2.0 Introduction 2.1 Unit Objectives 2.2 Number Systems 2.3 Bits and Bytes 2.4 Binary Number System 2.5 Decimal Number System 2.6 Octal Number System

D I G I T A L C I R C U I T S E E

D I G I T A L C I R C U I T S E E Digital Circuits Basic Scope and Introduction This book covers theory solved examples and previous year gate question for following topics: Number system, Boolean algebra,

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Instructor: Nicole Hynes nicole.hynes@rutgers.edu 1 Fixed Point Numbers Fixed point number: integer part

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Data Representation COE 30 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline Positional Number

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur 1 Number Representation 2 1 Topics to be Discussed How are numeric data items actually

Chapter 4. Operations on Data

Chapter 4 Operations on Data 1 OBJECTIVES After reading this chapter, the reader should be able to: List the three categories of operations performed on data. Perform unary and binary logic operations

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

Course Schedule CS 221 Computer Architecture Week 3: Information Representation (2) Fall 2001 W1 Sep 11- Sep 14 Introduction W2 Sep 18- Sep 21 Information Representation (1) (Chapter 3) W3 Sep 25- Sep

Computer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK

Computer (Literacy Skills Number representations and memory Lubomír Bulej KDSS MFF UK Number representations? What for? Recall: computer works with binary numbers Groups of zeroes and ones 8 bits (byte,

Introduction to Computer Science-103. Midterm

Introduction to Computer Science-103 Midterm 1. Convert the following hexadecimal and octal numbers to decimal without using a calculator, showing your work. (6%) a. (ABC.D) 16 2748.8125 b. (411) 8 265

Number Systems and Computer Arithmetic

Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras

Numbers and Computers Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras 1 Think of a number between 1 and 15 8 9 10 11 12 13 14 15 4 5 6 7 12 13 14 15 2 3 6 7 10 11 14 15

Numeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:

Numeral Systems -Numeral System -Positional systems -Decimal -Binary -Octal Subjects: Introduction A numeral system (or system of numeration) is a writing system for expressing numbers, that is a mathematical

Decimal & Binary Representation Systems. Decimal & Binary Representation Systems

Decimal & Binary Representation Systems Decimal & binary are positional representation systems each position has a value: d*base i for example: 321 10 = 3*10 2 + 2*10 1 + 1*10 0 for example: 101000001

Chapter 5 : Computer Arithmetic

Chapter 5 Computer Arithmetic Integer Representation: (Fixedpoint representation): An eight bit word can be represented the numbers from zero to 255 including = 1 = 1 11111111 = 255 In general if an nbit

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS (09 periods) Computer Arithmetic: Data Representation, Fixed Point Representation, Floating Point Representation, Addition and

Final Labs and Tutors

ICT106 Fundamentals of Computer Systems - Topic 2 REPRESENTATION AND STORAGE OF INFORMATION Reading: Linux Assembly Programming Language, Ch 2.4-2.9 and 3.6-3.8 Final Labs and Tutors Venue and time South

in this web service Cambridge University Press

978-0-51-85748- - Switching and Finite Automata Theory, Third Edition Part 1 Preliminaries 978-0-51-85748- - Switching and Finite Automata Theory, Third Edition CHAPTER 1 Number systems and codes This

World Inside a Computer is Binary

C Programming 1 Representation of int data World Inside a Computer is Binary C Programming 2 Decimal Number System Basic symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Radix-10 positional number system. The radix

The. Binary. Number System

The Binary Number System Why is Binary important? Everything on a computer (or other digital device) is represented by Binary Numbers One to Five in various systems 1 2 3 4 5 I II III IV V 1 10 11 100

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

N Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: a n a a a The value of this number is given by: = a n Ka a a a a a

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

CS 64 Lecture 2 Data Representation Reading: FLD 1.2-1.4 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) 1010 10?= 1010 2?= 1

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.

Data Representation 1

1 Data Representation Outline Binary Numbers Adding Binary Numbers Negative Integers Other Operations with Binary Numbers Floating Point Numbers Character Representation Image Representation Sound Representation

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. 1 Part 1: Data Representation Our goal: revisit and re-establish fundamental of mathematics for the computer architecture course Overview: what are bits

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.

Chapter 2. Data Representation in Computer Systems

Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting

Introduction to Numbering Systems

NUMBER SYSTEM Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems that we will work with are Binary Base 2 Octal Base 8 Hexadecimal

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction

1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in

Inf2C - Computer Systems Lecture 2 Data Representation

Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack

Decimal Binary Conversion Decimal Binary Place Value = 13 (Base 10) becomes = 1101 (Base 2).

DOMAIN I. NUMBER CONCEPTS Competency 00 The teacher understands the structure of number systems, the development of a sense of quantity, and the relationship between quantity and symbolic representations.

CS 64 Week 1 Lecture 1. Kyle Dewey

CS 64 Week 1 Lecture 1 Kyle Dewey Overview Bitwise operation wrap-up Two s complement Addition Subtraction Multiplication (if time) Bitwise Operation Wrap-up Shift Left Move all the bits N positions to

Digital Systems and Binary Numbers

Digital Systems and Binary Numbers Mano & Ciletti Chapter 1 By Suleyman TOSUN Ankara University Outline Digital Systems Binary Numbers Number-Base Conversions Octal and Hexadecimal Numbers Complements

CMPE223/CMSE222 Digital Logic Design. Positional representation

CMPE223/CMSE222 Digital Logic Design Number Representation and Arithmetic Circuits: Number Representation and Unsigned Addition Positional representation First consider integers Begin with positive only

Problem. Prove that the square of any whole number n is a multiple of 4 or one more than a multiple of 4.

CHAPTER 8 Integers Problem. Prove that the square of any whole number n is a multiple of 4 or one more than a multiple of 4. Strategy 13 Use cases. This strategy may be appropriate when A problem can be

A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

Complement Number Systems A complement number system is used to represent positive and negative integers A complement number system is based on a fixed length representation of numbers Pretend that integers

CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting

Numbering systems. Dr Abu Arqoub

Numbering systems The decimal numbering system is widely used, because the people Accustomed (معتاد) to use the hand fingers in their counting. But with the development of the computer science another

MC1601 Computer Organization

MC1601 Computer Organization Unit 1 : Digital Fundamentals Lesson1 : Number Systems and Conversions (KSB) (MCA) (2009-12/ODD) (2009-10/1 A&B) Coverage - Lesson1 Shows how various data types found in digital

In this lesson you will learn: how to add and multiply positive binary integers how to work with signed binary numbers using two s complement how fixed and floating point numbers are used to represent

Chapter 2 Data Representations

Computer Engineering Chapter 2 Data Representations Hiroaki Kobayashi 4/21/2008 4/21/2008 1 Agenda in Chapter 2 Translation between binary numbers and decimal numbers Data Representations for Integers

Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee

١ Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee Digital systems Digital systems are used in communication, business transactions, traffic control, spacecraft guidance, medical

Floating Point Arithmetic

Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? Unsigned 0 to 2 N 2s Complement -2 N-1 to 2 N-1-1 But, what about? very large numbers? 9,349,398,989,787,762,244,859,087,678

Organisasi Sistem Komputer

LOGO Organisasi Sistem Komputer OSK 8 Aritmatika Komputer 1 1 PT. Elektronika FT UNY Does the calculations Arithmetic & Logic Unit Everything else in the computer is there to service this unit Handles

Floating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !

Floating point Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties Next time! The machine model Chris Riesbeck, Fall 2011 Checkpoint IEEE Floating point Floating

Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997

Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 APPENDIX A.1 Number systems and codes Since ten-fingered humans are addicted to the decimal system, and since computers

CS321. Introduction to Numerical Methods

CS31 Introduction to Numerical Methods Lecture 1 Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 40506 0633 August 5, 017 Number

COMP2611: Computer Organization. Data Representation

COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How

(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)

COMPUTER ARITHMETIC 1. Addition and Subtraction of Unsigned Numbers The direct method of subtraction taught in elementary schools uses the borrowconcept. In this method we borrow a 1 from a higher significant

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.

Floating-point Arithmetic Reading: pp. 312-328 Floating-Point Representation Non-scientific floating point numbers: A non-integer can be represented as: 2 4 2 3 2 2 2 1 2 0.2-1 2-2 2-3 2-4 where you sum

CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting

MYcsvtu Notes DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes

DATA REPRESENTATION Data Types Complements Fixed Point Representations Floating Point Representations Other Binary Codes Error Detection Codes Hamming Codes 1. DATA REPRESENTATION Information that a Computer

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)

Computer Arithmetic Data is manipulated by using the arithmetic instructions in digital computers. Data is manipulated to produce results necessary to give solution for the computation problems. The Addition,

Chapter 10 Binary Arithmetics

27..27 Chapter Binary Arithmetics Dr.-Ing. Stefan Werner Table of content Chapter : Switching Algebra Chapter 2: Logical Levels, Timing & Delays Chapter 3: Karnaugh-Veitch-Maps Chapter 4: Combinational

Binary Systems and Codes

1010101010101010101010101010101010101010101010101010101010101010101010101010101010 1010101010101010101010101010101010101010101010101010101010101010101010101010101010 1010101010101010101010101010101010101010101010101010101010101010101010101010101010

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-278: Digital Logic Design Fall Notes - Unit 4. hundreds.

ECE-78: Digital Logic Design Fall 6 UNSIGNED INTEGER NUMBERS Notes - Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digit-by-digit representation of a positive integer number (powers

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,

CPE300: Digital System Architecture and Design

CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Arithmetic Unit 10122011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Recap Fixed Point Arithmetic Addition/Subtraction

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700: Digital Logic Design Winter Notes - Unit 4. hundreds.

UNSIGNED INTEGER NUMBERS Notes - Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digit-by-digit representation of a positive integer number (powers of ): DIGIT 3 4 5 6 7 8 9 Number: