# To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

Save this PDF as:

Size: px
Start display at page:

Download "To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:"

## Transcription

1 Binary Numbers In computer science we deal almost exclusively with binary numbers. it will be very helpful to memorize some binary constants and their decimal and English equivalents. By English equivalents we mean expressions such as 10 Megabytes, 45 Kilobytes, and 200Gigahertz (a byte is eight binary digits treated as a group to represent a single quantity. A byte of storage is typically required to store a single alphanumeric character.) 2 0 =1 =1 2 5 =32 = =2 = =64 = =4 = =128 = =8 = =256 = =16 = =512 = Large quantities are generally given in powers of two, but also have English names commonly associated with powers of ten. For instance, 1 Kilobyte is not 1000 (10 3 ) bytes, but is 2 10 (1024) bytes and is referred to as a kilobyte, or 1KB. In computer science, the phrase one thousand will usually mean , not Similarly, a million is 2 20 and a billion is 2 30 ; 2 20 bytes is called a megabyte (1 MB), and 2 30 bytes is a gigabyte (1 GB) =1024=1K =1M 2 30 =1G To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic: Examples: 2 a+b = 2 a x 2 b 2 a-b = 2 a /2 b 2 -a = 1/2 a 12. Converting binary exponential expressions to 'English'abbreviation 2 12 = 2 2 x 2 10 = 4 x 1K = 4K 3 Note, Kilobyte is denoted by KB (and Kilobit is denoted by Kb). The K, M, and G identify only the prefixes, since we may count other things besides bytes. NTC 1/23/05 21

2 2 33 = 2 3 x 2 30 = 8 x 1G = 8G 2 27 = 2 7 x 2 20 = 128 x 1M = 128M 13. Converting 'English'abbreviations to binary exponential expressions. 32G = 32 x 1G = 2 5 x 2 30 = K = 16 x 1K = 2 4 x 2 10 = M = 512 x 1M = 2 9 x 2 20 = 2 29 Practice Problems - Binary-to-English Conversions 1. Convert the following binary exponential expressions to their 'English' counterparts: Convert the following 'English'expressions to their binary exponential equivalents: 3. Word problems 1K M 32K 128G 2M 4G 512K 8M a. How much memory is supported by a system with 24-bit memory addresses? b. How large an address is needed to address a memory of 4GB? c. How many op code bits are need in an instruction which supports 128 different operations? d. How many registers are supported by an instruction with a register ID field of 6 bits? Binary Number Conversion We will frequently have occasion to convert binary numbers to decimal numbers. The techniques previously described for number systems in general are fully applicable here. For example, converting binary to decimal: = 1x x x x x x x2 0 NTC 1/23/05 22

3 = = =1x x x2-3 = 1/ / /2 3 = 1/2 + 0/4 + 1/8 = (4+1)/8 = 5/8 = For the interested student, note that there are ways to speed up the conversion of integer binary numbers to decimal. They rely on two things. First that you memorized the decimal/binary equivalents of the numbers 0 thru 15, as shown in table TN1; second, remember that shifting a binary number one position to the left (inserting a zero in the rightmost postion) multiplies that number by 2 (just as shifting a decimal number to the left multiplies it by 10). Then could be rapidly converted as follows: = = 11 x since the first 4 digits (1011 = 11) are shifted 3 places (=8) = or, equivalently, = = 10 x = Examples of converting decimal to binary: to binary - 91/2 = 45 with a remainder of 1 45/2 = 22 with a remainder of 1 22/2 = 11 with a remainder of 0 11/2 = 5 with a remainder of 1 5/2 = 2 with a remainder of 1 2/2 = 1 with a remainder of 0 1/2 = 0 with a remainder of 1 giving to binary -.75 x 2 = 1.50 first digit is 1.50 x 2 = 1.00 second digit is 1.00 x 2 = 0 we are done giving.11 2 NTC 1/23/05 23

4 Alternatively, some students find it faster to use the following scheme for converting decimal integer numbers to binary. Simply find the largest power of 2 which is smaller than or equal to the given number (you should have memorized the first 10 powers of 2), and subtract this power of two from the number. Continue subtracting powers of two from the result of the previous subtraction until the result is zero. The powers of 2 which were able to be subtracted are then the positions of all the 1's in the result. Example, = 27 Therefore 64 = 2 6 is the position of the first = 11 Therefore 16 = 2 4 is the position of the second = 3 8 = 2 3 is the third position 3-2 = 1 2 = 2 1 is the fourth position 1-1 = 0 1 =2 0 is the fifth 1 in the answer giving Negative Binary Numbers In what follows, keep in mind that, since we are interested in using these numbers within the hardware of a computer, there is a finite amount (usually small) of space (storage) allocated for each number. In the computer s memory this may be referred to as a word. In the CPU such data is held in storage devices called registers. Each register has a finite size, measured in bits, where each bit is a binary digit (in fact, the word bit is a contraction of the words binary digit. We assume that every binary number uses all the bits available in the specified register. A group of adjacent 8 bits in a register is called a byte. A 32-bit register, therefore, is also a 4-byte register. There are six common ways of representing a number in binary: Unsigned Sign and Magnitude 2's complement Biased Binary Coded Decimal Floating Point The second, third and fourth are binary representations which allow for the representation of negative as well as positive numbers. 5. Unsigned binary numbers. All the bits in the register are weighted per there bit positions, and are numbered 0 through n-1 from right to left. If the register is n NTC 1/23/05 24

5 bits wide, it can hold 2 n different values, in the range (assuming integers only) of 0 through +2 n - 1. For example, a 16-bit register holds 2 16 = values, 0 thru Note that all arithmetic results which end up in an n-bit register can never have a value greater than 2 n - 1, and is thus effectively arithmetic modulo 2 n. Keep this in mind for future discussion. 6. Sign and Magnitude. In this convention, only bits 0 through n-2 are used to hold the number, bit n-1 (the most significant bit) is used to specify the sign of the number. A zero in position n-1 means that the number is positive, a one in position n-1 means that the number is negative. In an eight bit register, for example, bit 7 represents the sign. The number is the number (the same as if the number were unsigned), and is (this would be if it were an unsigned number). The range of values able to be represented in this form is -(2 n-1-1) through +2 n-1-1. The values in a 16 bit register are thru One problem with this convention is that 0 10 has two representations: and 's complement. Both 2's complement and 1's complement may be used to incorporate both positive and negative number representations in a computer; we will focus on 2's complement for reasons that will become clear later. As in the previously mentioned conventions, positive numbers (and zero) are represented normally, just as if they were unsigned binary numbers. However, the negative of a number in 2's complement form is simply the value you get when you subtract the positive representation of the number from 2 n. That is, if x is binary n-bit number, then -x = 2 n - x [N10] There is a simple way to perform this operation without actually having to do subtraction, consisting of a two step process as follows: i. Complement the value. That is, change every 1 to a 0 and every 0 to a 1. ii. Add 1 to the result of the first step. For example, in an eight bit register, the number is given by Complementing this gives Adding 1 gives which is used to represent Recall that when converting a binary number to a decimal number, we simply add up all the weighted values of the positions in the binary where there is a 1. To convert a 2's complement number, the same procedure is applied, but the weight NTC 1/23/05 25

7 = , not (which would be - 13) To convert a negative decimal number to 2's complement form a. Convert the number to binary, assuming it is positive, as above; b. Use the complement-and-add procedure to convert the positive 2's complement number into a negative 2's complement number. Example 15: Represent in 2's complement notation. a. +19 = (remember to include the leading 0!) b. complement and add: = 's Complement to Decimal Conversion To convert a binary 2's complement number (regardless of sign) to decimal, use [N11]. That is, sum up the weights of all the positions containing a one, except that the weight of the most significant bit is negative. Example: = = = = Value of bit n-1 Value of remainin g bits Example : +19 Unsigned d n-1 2 n-1 d i r i n/a Sign & Magnitude Example : -19 sign d i r i 's Complement -d n-1 2 n-1 d i r i Table TN2. Table TN2 summarizes these number formats and includes the previous examples. Notice that these formats differ only in the interpretation of the most significant bit position (2 n-1 ), and that positive numbers have the same representation regardless of format (although the leading 0 is not required if the number is known to be in unsigned format.) NTC 1/23/05 27

8 Practice problems - 2's Complement Numbers: 1. Given the binary number , what is its decimal value if it is a a. unsigned binary number (Ans: 219) b. sign and complement number (Ans: -91) c. 2's complement number (Ans: -37) 2. Convert +24 into a 2's complement number (Ans: Note the leading zero!) 3. Convert -24 into a 2's complement number (Ans: ) 4. Convert -1 into a 2's complement number (assume a 4-bit result) (Ans: 1111) Note that -1 is regardless of the size of the register. Note also that any positive or negative 2's complement number can have its leading digit propagated to the left without changing the number. 5. What is the minimum (maximum negative) number which can be represented using a 6-bit 2's Complement representation? What is the maximum (positive) number? 6. What is the minimum (maximum negative) number which can be represented using a n-bit 2's Complement representation? What is the maximum (positive) number? Convert, if possible, the following decimal numbers to 2's complement assuming an 8-bit binary representation for all Convert the following 2's complement numbers to decimal NTC 1/23/05 28

9 Biased numbers - It is sometimes desirable (we ll see an example in a bit) to have the range of negative and positive numbers by monotonically increasing - that is, each successive number is determined by adding one to the previous number. Basically, we take our numerical sequence, and shift the meanings of the combinations of ones and zero so that some of the combinations are negative in interpretation. For example, using three bit binary numbers: binary unsigned Bias(3) Notice that the decimal values have been shifted down (or biased by) 3 positions, eliminating the values 5 thru 7 and inserting the values -3 thru -1. The value of the bias is usually chosen to be roughly one half of the total range of numbers available, which is determined by the number of bits allocated to the number. In the above example, three bits give a total of eight numbers, 0 thru 7; we would generally choose a bias of three or four, depending on whether we wanted more positive or negative numbers. In general, for the purposes of this text, choose a bias as follows: 1. Given the maximum number of binary bits, n, choose a bias 4 = 2 n /2 = 2 n-1 If n = 8, the bias should be 128 ( = 2 8 /2 = 256/2 = 128 = = 2 7 If n = 16, the bias should be 2 16 /2 = 32K 2. Given a negative decimal number, assume a bias equal to the minimum power 4 In practice, the bias is general chosen to be 1 less then the values presented here. For instance, as we will see, the IEEE single-precision floating point specification, which uses a biased 8 bit number for the exponent representation uses a bias of 127, not 128. NTC 1/23/05 29

10 of two greater than the absolute value of the negative decimal number. Also, if 2m is the bias, then the number of bits in the biased representation must be m+1. This is because, if the bias is 2 m, then the range of numbers to be represented is - 2 m -1 thru +2 m for a total range of 2 x 2 m = 2 m+1. This requires m+1 bits in the binary biased representation. If the negative decimal number is -23 assume a bias equal to 32. The number of bits in the biased representation will be 6. If the negative decimal number is -129 assume a bias equal to 256. The number of bits in the biased representation will be 9. Converting Decimal numbers to Biased binary numbers Examples: 1. Add the bias to the decimal number 2. convert the resulting decimal number to binary 16. Assume a five-bit biased binary representation. What bias would you use? (Ans. 15 or 16, usually 15). 17. Using this bias, convert the decimal numbers 0, 6, and -12 to biased format. Ans: = 15 = = 21 = = 3 = Convert -49 to biased binary representation. Choose a bias equal to 2 m such that 2 m > 49. In this case, the bias = 64. Then a. Add the bias: = 15 b. Convert the result to binary: = Notice that, since 2 m = 64, m = 6 and the binary representation must contain m+1 bit positions (7 in this case). Converting biased binary numbers to decimal 1. Convert the biased binary number to decimal NTC 1/23/05 30

11 Examples: 2. Subtract the bias from the resulting decimal number 19. Convert the biased binary number to decimal Since there are 6 binary digits, assume the bias is 2 6 /2 = 2 5 =32 1. Convert to decimal: = Subtract the bias: = Convert the biased binary number to decimal. Since there are 8 bits, assume a bias of = = Convert 0001 to decimal. Bias = = = NTC 1/23/05 31

12 Practice Problems - Biased Binary Numbers 1. What bias should you choose for biased binary representations with each of the following number of bits? a. 8 bits b. 2 bits c. 24 bitsd. 13 bits 2. What bias should you choose for biased binary representation of each of the following decimal numbers? a. -10 b c d Convert the following decimal numbers to the appropriate biased binary format. a. -34 b. -12 c d Convert the following biased binary numbers to decimal a. 101 b c d Table TN3 shows the decimal values associated with the binary numbers 0000 through 1111 in each of the binary number representations discussed. NTC 1/23/05 32

13 UNSIGNED BINARY UNSIGNED DECIMAL SIGN & MAGNI- TUDE 2'S COMPL- EMENT BIAS(8) BIAS(7) Table TN3. Note: The above representations of binary numbers seem to refer to only integers. However, a binary point (as opposed to a decimal point) could be assumed to be anywhere in the register holding the number. If we have an eight bit (1 byte) register containing the bits , it might, depending on the application, be interpreted to contain = , or = , or = These are called Fixed Point numbers, in contrast to floating point numbers which will be discussed shortly. Note that shifting a binary number left (and inserting a zero into the least significant digit) is the same as multiplying by 2. Compare this to adding a low order zero to a decimal number. Shifting right performs the DIV 2 operation, since the least significant NTC 1/23/05 33

14 bits are shifted out of the register and are lost = = = NTC 1/23/05 34

### 1. Convert the following binary exponential expressions to their 'English'

Answers to Practice Problems Practice Problems - Integer Number System Conversions 1. Convert the decimal integer 427 10 into the following number systems: a. 110101011 2 c. 653 8 b. 120211 3 d. 1AB 16

### Lab 1: Information Representation I -- Number Systems

Unit 1: Computer Systems, pages 1 of 7 - Department of Computer and Mathematical Sciences CS 1408 Intro to Computer Science with Visual Basic 1 Lab 1: Information Representation I -- Number Systems Objectives:

### Lab 1: Information Representation I -- Number Systems

Unit 1: Computer Systems, pages 1 of 7 - Department of Computer and Mathematical Sciences CS 1410 Intro to Computer Science with C++ 1 Lab 1: Information Representation I -- Number Systems Objectives:

### Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we

### Here 4 is the least significant digit (LSD) and 2 is the most significant digit (MSD).

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

### Two s Complement Arithmetic

Two s Complement Arithmetic We now address the issue of representing integers as binary strings in a computer. There are four formats that have been used in the past; only one is of interest to us. The

### Data Representation Binary Numbers

Data Representation Binary Numbers Integer Conversion Between Decimal and Binary Bases Task accomplished by Repeated division of decimal number by 2 (integer part of decimal number) Repeated multiplication

### Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

### Number Systems Richard E. Haskell

NUMBER SYSTEMS D Number Systems Richard E. Haskell Data inside a computer are represented by binary digits or bits. The logical values of these binary digits are denoted by and, while the corresponding

### By the end of the lecture, you should be able to:

Extra Lecture: Number Systems Objectives - To understand: Base of number systems: decimal, binary, octal and hexadecimal Textual information stored as ASCII Binary addition/subtraction, multiplication

### Activity 1: Bits and Bytes

ICS3U (Java): Introduction to Computer Science, Grade 11, University Preparation Activity 1: Bits and Bytes The Binary Number System Computers use electrical circuits that include many transistors and

### Digital Fundamentals

Digital Fundamentals with PLD Programming Floyd Chapter 2 29 Pearson Education Decimal Numbers The position of each digit in a weighted number system is assigned a weight based on the base or radix of

### CHAPTER 3 Number System and Codes

CHAPTER 3 Number System and Codes 3.1 Introduction On hearing the word number, we immediately think of familiar decimal number system with its 10 digits; 0,1, 2,3,4,5,6, 7, 8 and 9. these numbers are called

### CPE 323 Data Types and Number Representations

CPE 323 Data Types and Number Representations Aleksandar Milenkovic Numeral Systems: Decimal, binary, hexadecimal, and octal We ordinarily represent numbers using decimal numeral system that has 10 as

### MT1 Number Systems. In general, the number a 3 a 2 a 1 a 0 in a base b number system represents the following number:

MT1 Number Systems MT1.1 Introduction A number system is a well defined structured way of representing or expressing numbers as a combination of the elements of a finite set of mathematical symbols (i.e.,

### Chapter II Binary Data Representation

Chapter II Binary Data Representation The atomic unit of data in computer systems is the bit, which is actually an acronym that stands for BInary digit. It can hold only 2 values or states: 0 or 1, true

### Chapter 4. Computer Arithmetic

Chapter 4 Computer Arithmetic 4.1 Number Systems A number system uses a specific radix (base). Radices that are power of 2 are widely used in digital systems. These radices include binary (base 2), quaternary

### Number Representation and Arithmetic in Various Numeral Systems

1 Number Representation and Arithmetic in Various Numeral Systems Computer Organization and Assembly Language Programming 203.8002 Adapted by Yousef Shajrawi, licensed by Huong Nguyen under the Creative

### Integer Numbers. The Number Bases of Integers Textbook Chapter 3

Integer Numbers The Number Bases of Integers Textbook Chapter 3 Number Systems Unary, or marks: /////// = 7 /////// + ////// = ///////////// Grouping lead to Roman Numerals: VII + V = VVII = XII Better:

### Quiz for Chapter 3 Arithmetic for Computers 3.10

Date: Quiz for Chapter 3 Arithmetic for Computers 3.10 Not all questions are of equal difficulty. Please review the entire quiz first and then budget your time carefully. Name: Course: Solutions in RED

### Useful Number Systems

Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2

### Integer and Real Numbers Representation in Microprocessor Techniques

Brno University of Technology Integer and Real Numbers Representation in Microprocessor Techniques Microprocessor Techniques and Embedded Systems Lecture 1 Dr. Tomas Fryza 30-Sep-2011 Contents Numerical

### Base Conversion written by Cathy Saxton

Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,

### Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be

### 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 2.1 Introduction 47 2.2 Positional Numbering Systems 48 2.3 Converting Between Bases 48 2.3.1 Converting Unsigned Whole Numbers 49 2.3.2 Converting Fractions

### 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

### CHAPTER THREE. 3.1 Binary Addition. Binary Math and Signed Representations

CHAPTER THREE Binary Math and Signed Representations Representing numbers with bits is one thing. Doing something with them is an entirely different matter. This chapter discusses some of the basic mathematical

### Number Systems and. Data Representation

Number Systems and Data Representation 1 Lecture Outline Number Systems Binary, Octal, Hexadecimal Representation of characters using codes Representation of Numbers Integer, Floating Point, Binary Coded

### Number Representation

Number Representation Number System :: The Basics We are accustomed to using the so-called decimal number system Ten digits ::,,,3,4,5,6,7,8,9 Every digit position has a weight which is a power of Base

### CSI 333 Lecture 1 Number Systems

CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...

### Presented By: Ms. Poonam Anand

Presented By: Ms. Poonam Anand Know the different types of numbers Describe positional notation Convert numbers in other bases to base 10 Convert base 10 numbers into numbers of other bases Describe the

### 6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10

Lesson The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base- system. When you

### Number Systems and Base Conversions

Number Systems and Base Conversions As you know, the number system that we commonly use is the decimal or base- 10 number system. That system has 10 digits, 0 through 9. While it's very convenient for

### 2.1 Binary Numbers. 2.3 Number System Conversion. From Binary to Decimal. From Decimal to Binary. Section 2 Binary Number System Page 1 of 8

Section Binary Number System Page 1 of 8.1 Binary Numbers The number system we use is a positional number system meaning that the position of each digit has an associated weight. The value of a given number

### CSE 1400 Applied Discrete Mathematics Conversions Between Number Systems

CSE 400 Applied Discrete Mathematics Conversions Between Number Systems Department of Computer Sciences College of Engineering Florida Tech Fall 20 Conversion Algorithms: Decimal to Another Base Conversion

### 1 Basic Computing Concepts (4) Data Representations

1 Basic Computing Concepts (4) Data Representations The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The

### Data types. lecture 4

Data types lecture 4 Information in digital computers is represented using binary number system. The base, i.e. radix, of the binary system is 2. Other common number systems: octal (base 8), decimal (base

### Introduction Number Systems and Conversion

UNIT 1 Introduction Number Systems and Conversion Objectives 1. Introduction The first part of this unit introduces the material to be studied later. In addition to getting an overview of the material

### Binary Representation and Computer Arithmetic

Binary Representation and Computer Arithmetic The decimal system of counting and keeping track of items was first created by Hindu mathematicians in India in A.D. 4. Since it involved the use of fingers

### ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g.,

### Data Representation in Computers

Chapter 3 Data Representation in Computers After studying this chapter the student will be able to: *Learn about binary, octal, decimal and hexadecimal number systems *Learn conversions between two different

### TECH. Arithmetic & Logic Unit. CH09 Computer Arithmetic. Number Systems. ALU Inputs and Outputs. Binary Number System

CH09 Computer Arithmetic CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer Representation Integer Arithmetic Floating-Point Representation

### Bits, Data Types, and Operations. University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell

Bits, Data Types, and Operations University of Texas at Austin CS3H - Computer Organization Spring 2 Don Fussell How do we represent data in a computer? At the lowest level, a computer is an electronic

### The string of digits 101101 in the binary number system represents the quantity

Data Representation Section 3.1 Data Types Registers contain either data or control information Control information is a bit or group of bits used to specify the sequence of command signals needed for

### Number Representation

Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data

### Chapter 2 Numeric Representation.

Chapter 2 Numeric Representation. Most of the things we encounter in the world around us are analog; they don t just take on one of two values. How then can they be represented digitally? The key is that

### Theory of Logic Circuits. Laboratory manual. Exercise 6

Zakład Mikroinformatyki i Teorii Automatów Cyfrowych Theory of Logic Circuits Laboratory manual Exercise 6 Selected arithmetic switching circuits 2008 Tomasz Podeszwa, Piotr Czekalski (edt.) 1. Number

### Lecture 8: Binary Multiplication & Division

Lecture 8: Binary Multiplication & Division Today s topics: Addition/Subtraction Multiplication Division Reminder: get started early on assignment 3 1 2 s Complement Signed Numbers two = 0 ten 0001 two

### Data Representation. Data Representation, Storage, and Retrieval. Data Representation. Data Representation. Data Representation. Data Representation

, Storage, and Retrieval ULM/HHIM Summer Program Project 3, Day 3, Part 3 Digital computers convert the data they process into a digital value. Text Audio Images/Graphics Video Digitizing 00000000... 6/8/20

### Encoding Systems: Combining Bits to form Bytes

Encoding Systems: Combining Bits to form Bytes Alphanumeric characters are represented in computer storage by combining strings of bits to form unique bit configuration for each character, also called

### Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

Digital Arithmetic Digital Arithmetic: Operations and Circuits Dr. Farahmand Binary Arithmetic Digital circuits are frequently used for arithmetic operations Fundamental arithmetic operations on binary

### Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: -Our standard number system is base, also

### Number Systems & Encoding

Number Systems & Encoding Lecturer: Sri Parameswaran Author: Hui Annie Guo Modified: Sri Parameswaran Week2 1 Lecture overview Basics of computing with digital systems Binary numbers Floating point numbers

### Lecture 2. Binary and Hexadecimal Numbers

Lecture 2 Binary and Hexadecimal Numbers Purpose: Review binary and hexadecimal number representations Convert directly from one base to another base Review addition and subtraction in binary representations

Review of Number Systems The study of number systems is important from the viewpoint of understanding how data are represented before they can be processed by any digital system including a computer. Different

### Review of Number Systems Binary, Octal, and Hexadecimal Numbers and Two's Complement

Review of Number Systems Binary, Octal, and Hexadecimal Numbers and Two's Complement Topic 1: Binary, Octal, and Hexadecimal Numbers The number system we generally use in our everyday lives is a decimal

### Chapter 3: Number Systems

Slide 1/40 Learning Objectives In this chapter you will learn about: Non-positional number system Positional number system Decimal number system Binary number system Octal number system Hexadecimal number

### NUMBERING SYSTEMS C HAPTER 1.0 INTRODUCTION 1.1 A REVIEW OF THE DECIMAL SYSTEM 1.2 BINARY NUMBERING SYSTEM

12 Digital Principles Switching Theory C HAPTER 1 NUMBERING SYSTEMS 1.0 INTRODUCTION Inside today s computers, data is represented as 1 s and 0 s. These 1 s and 0 s might be stored magnetically on a disk,

### This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition

### Fixed-point Representation of Numbers

Fixed-point Representation of Numbers Fixed Point Representation of Numbers Sign-and-magnitude representation Two s complement representation Two s complement binary arithmetic Excess code representation

### = Chapter 1. The Binary Number System. 1.1 Why Binary?

Chapter The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base-0 system. When you

### Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Decimal Division Remember 4th grade long division? 43 // quotient 12 521 // divisor dividend -480 41-36 5 // remainder Shift divisor left (multiply by 10) until MSB lines up with dividend s Repeat until

### Computer is a binary digital system. Data. Unsigned Integers (cont.) Unsigned Integers. Binary (base two) system: Has two states: 0 and 1

Computer Programming Programming Language Is telling the computer how to do something Wikipedia Definition: Applies specific programming languages to solve specific computational problems with solutions

### Radix Number Systems. Number Systems. Number Systems 4/26/2010. basic idea of a radix number system how do we count:

Number Systems binary, octal, and hexadecimal numbers why used conversions, including to/from decimal negative binary numbers floating point numbers character codes basic idea of a radix number system

### Computer Architecture CPIT 210 LAB 1 Manual. Prepared By: Mohammed Ghazi Al Obeidallah.

Computer Architecture CPIT 210 LAB 1 Manual Prepared By: Mohammed Ghazi Al Obeidallah malabaidallah@kau.edu.sa LAB 1 Outline: 1. Students should understand basic concepts of Decimal system, Binary system,

### Lecture 1 Introduction, Numbers, and Number System Page 1 of 8

Lecture Introduction, Numbers and Number System Contents.. Number Systems (Appendix B)... 2. Example. Converting to Base 0... 2.2. Number Representation... 2.3. Number Conversion... 3. To convert a number

### ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g.,

### Calculation of Exponential Numbers

Calculation of Exponential Numbers Written by: Communication Skills Corporation Edited by: The Science Learning Center Staff Calculation of Exponential Numbers is a written learning module which includes

### ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-470/570: Microprocessor-Based System Design Fall 2014.

REVIEW OF NUMBER SYSTEMS Notes Unit 2 BINARY NUMBER SYSTEM In the decimal system, a decimal digit can take values from to 9. For the binary system, the counterpart of the decimal digit is the binary digit,

### Introduction to Telecommunications and Computer Engineering Unit 2: Number Systems and Logic

Introduction to Telecommunications and Computer Engineering Unit 2: Number Systems and Logic Syedur Rahman Lecturer, CSE Department North South University syedur.rahman@wolfson.oon.org Acknowledgements

### CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

CDA 3200 Digital Systems Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 Outline Data Representation Binary Codes Why 6-3-1-1 and Excess-3? Data Representation (1/2) Each numbering

### CSC 1103: Digital Logic. Lecture Six: Data Representation

CSC 1103: Digital Logic Lecture Six: Data Representation Martin Ngobye mngobye@must.ac.ug Mbarara University of Science and Technology MAN (MUST) CSC 1103 1 / 32 Outline 1 Digital Computers 2 Number Systems

### Number System. Some important number systems are as follows. Decimal number system Binary number system Octal number system Hexadecimal number system

Number System When we type some letters or words, the computer translates them in numbers as computers can understand only numbers. A computer can understand positional number system where there are only

### Decimal Numbers: Base 10 Integer Numbers & Arithmetic

Decimal Numbers: Base 10 Integer Numbers & Arithmetic Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 )+(1x10 0 ) Ward 1 Ward 2 Numbers: positional notation Number

### Switching Circuits & Logic Design

Switching Circuits & Logic Design Jie-Hong Roland Jiang 江介宏 Department of Electrical Engineering National Taiwan University Fall 2013 1 1 Number Systems and Conversion Babylonian number system (3100 B.C.)

### MIPS floating-point arithmetic

MIPS floating-point arithmetic Floating-point computations are vital for many applications, but correct implementation of floating-point hardware and software is very tricky. Today we ll study the IEEE

### Unit 2: Number Systems, Codes and Logic Functions

Unit 2: Number Systems, Codes and Logic Functions Introduction A digital computer manipulates discrete elements of data and that these elements are represented in the binary forms. Operands used for calculations

### Binary Numbers. Bob Brown Information Technology Department Southern Polytechnic State University

Binary Numbers Bob Brown Information Technology Department Southern Polytechnic State University Positional Number Systems The idea of number is a mathematical abstraction. To use numbers, we must represent

### COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

### A First Book of C++ Chapter 2 Data Types, Declarations, and Displays

A First Book of C++ Chapter 2 Data Types, Declarations, and Displays Objectives In this chapter, you will learn about: Data Types Arithmetic Operators Variables and Declarations Common Programming Errors

### Digital Electronics. 1.0 Introduction to Number Systems. Module

Module 1 www.learnabout-electronics.org Digital Electronics 1.0 Introduction to What you ll learn in Module 1 Section 1.0. Recognise different number systems and their uses. Section 1.1 in Electronics.

### After adjusting the expoent value of the smaller number have

1 (a) Provide the hexadecimal representation of a denormalized number in single precision IEEE 754 notation. What is the purpose of denormalized numbers? A denormalized number is a floating point number

### CHAPTER TWO. 2.1 Unsigned Binary Counting. Numbering Systems

CHAPTER TWO Numbering Systems Chapter one discussed how computers remember numbers using transistors, tiny devices that act like switches with only two positions, on or off. A single transistor, therefore,

### Floating Point Numbers. Question. Learning Outcomes. Number Representation - recap. Do you have your laptop here?

Question Floating Point Numbers 6.626068 x 10-34 Do you have your laptop here? A yes B no C what s a laptop D where is here? E none of the above Eddie Edwards eedwards@doc.ic.ac.uk https://www.doc.ic.ac.uk/~eedwards/compsys

### Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems - Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x

### Binary Numbers Again. Binary Arithmetic, Subtraction. Binary, Decimal addition

Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N -1. 4 bits = 0 to 15 8 bits = 0 to 255 16 bits = 0 to 65535 Besides simply representation, we would

### Binary Numbers. Binary Numbers. Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria

Binary Numbers Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Wolfgang.Schreiner@risc.uni-linz.ac.at http://www.risc.uni-linz.ac.at/people/schreine

### Number Systems, Base Conversions, and Computer Data Representation

, Base Conversions, and Computer Data Representation Decimal and Binary Numbers When we write decimal (base 10) numbers, we use a positional notation system. Each digit is multiplied by an appropriate

### EE 261 Introduction to Logic Circuits. Module #2 Number Systems

EE 261 Introduction to Logic Circuits Module #2 Number Systems Topics A. Number System Formation B. Base Conversions C. Binary Arithmetic D. Signed Numbers E. Signed Arithmetic F. Binary Codes Textbook

### Binary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1

Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1

### 23 1 The Binary Number System

664 Chapter 23 Binary, Hexadecimal, Octal, and BCD Numbers 23 The Binary Number System Binary Numbers A binary number is a sequence of the digits 0 and, such as 000 The number shown has no fractional part

### FLOATING POINT NUMBERS

FLOATING POINT NUMBERS Introduction Richard Hayden (with thanks to Naranker Dulay) rh@doc.ic.ac.uk http://www.doc.ic.ac.uk/~rh/teaching or https://www.doc.ic.ac.uk/~wl/teachlocal/arch1 or CATE Numbers:

### A Short Introduction to Binary Numbers

A Short Introduction to Binary Numbers Brian J. Shelburne Department of Mathematics and Computer Science Wittenberg University 0. Introduction The development of the computer was driven by the need to

### 198:211 Computer Architecture

198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book 1 Computer Architecture What do computers do? Manipulate stored

### Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Computers CMPT 125: Lecture 1: Understanding the Computer Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 A computer performs 2 basic functions: 1.

### Solution for Homework 2

Solution for Homework 2 Problem 1 a. What is the minimum number of bits that are required to uniquely represent the characters of English alphabet? (Consider upper case characters alone) The number of

### Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must be able to handle more than just values for real world problems