UNIT 2 : NUMBER SYSTEMS

Size: px
Start display at page:

Download "UNIT 2 : NUMBER SYSTEMS"

Transcription

1 UNIT 2 : NUMBER SYSTEMS page 2.0 Introduction Decimal Numbers The Binary System The Hexadecimal System Number Base Conversion Decimal To Binary Decimal to Hex Binary to Decimal Hex to Decimal Binary to Hexadecimal Hexadecimal to Binary Binary Arithmetic Hexadecimal Arithmetic 13 Answers to SAQs Introduction The purpose of the unit is to introduce number systems in general, and working with the binary and hexadecimal systems in particular. This material will provide an essential background for the representation of information within a digital computer, which is the content of unit 4. We will start by establishing important facts about the number system we use, the decimal or base ten system, which apply to number systems in general. This will lead on to the systems used by digital computers: binary and hexadecimal.. Methods of conversion between the different systems will then be covered, followed by the simple addition and subtraction of binary and hexadecimal numbers. LCS, Edinburgh Page 1 of 17

2 2.1 Decimal Numbers This is the number system with which we are all familiar. It is based on counting in tens (i.e. base 10) and is referred to as the denary or decimal system. If there were only one symbol to represent numeric quantities then numbers would be most cumbersome. For example, arithmetic might look like + = Luckily this has been avoided and we use the symbols 1 to 9 to represent the first nine values and the symbol 0 to represent absence of a numeric quantity, as shown below. quantity symbol The denary system uses ten different symbols. The symbols used to represent quantities in a number system are known as its digits. Quantities greater than nine in value are notated by using combinations of the existing digits, arranged in columns. This is a positional notation and as a digit moves left by a column, its value increases by a factor of ten. For example the number 567 consists of five 1 s plus five 10 s plus five 100 s x 100 = x 10 = 60 7 x 1 = 7 Each column has a value or weight associated with it. The first column is always units, the next column to the left indicates the number of 10 s, the column to the left of this is the number of 100 s etc. A digit appearing in any column is multiplied by the column s weight to give the numeric value being referred to. The positional notation is usually illustrated as follows: s 1000 s 100 s 10 s 1 s LCS, Edinburgh Page 2 of 17

3 The value of each column can be expressed as a power of ten. By definition, any number raised to the power of zero is 1, therefore the units column may be written as The pattern is obvious, and the next column to appear in the above will have the weight 10 5 or The notation may also be extended to the right of the units column to indicate fractional values, and the first will have the value 10-1, or 1/10ths, then 10-2 or 1/100ths etc. The fractional part is separated from the whole part with a point, as in This is illustrated below s 1000 s 100 s 10 s 1 s. 1/10 s 1/100 s 1/1000 s We do not need to know about fractional numbers We have now enough information to state two facts about number systems: The base of a number system equals the number of digits available. Numbers are represented using a positional notation. Any number has at least one digit, which is always positioned in the least significant or units column. This column has a weight given by the base of the system raised to the power of 0. The next column has a weight given by the base raised to the power of 1. Each subsequent column has a weight raised by one more power of the base. 2.2 The Binary System The binary number system has a base of 2. That is, there are only two symbols, 0 and 1. Any number larger than 1 must be represented using combinations of the two binary digits. The value of each position in a binary number is a power of 2. This is illustrated for the first six positions, as follows: 32 s 16 s 8 s 4 s 2 s 1 s As an example, consider the binary number Starting at the rightmost position, there is one unit, zero twos, one four, zero eights, one sixteen and one thirty-two. LCS, Edinburgh Page 3 of 17

4 x 1 = 1 0 x 2 = 0 1 x 4 = 4 0 x 8 = 0 1 x 16 = 16 1 x 32 = Adding together the products from each position gives the corresponding decimal value of 53. We may write which states that the binary number is the same as the decimal value 53. The subscript 2 is to indicate that the number is base 2, and the subscript 10 indicates the number is decimal. This is important since a number, such as 101 may be interpreted as the binary value 101 (which is 5 in decimal), or as the decimal value 101 (one hundred and one). When referring to a binary number such as 101 2, it should be pronounced as one zero one, and not as one hundred and one. As another example we shall determine the equivalent decimal value of Examining the contents of each column, we find (1 x 8) + (1 x 4) + (1 x 2) + (1 x 1) = = The decimal value of a binary number is simply given by summing the values contained in each position of the number. The formal methods of converting between binary and decimal systems are covered in sections and SAQ 2.1 Why is the symbol 2 never used in a number which is represented in base 2? LCS, Edinburgh Page 4 of 17

5 2.3 The Hexadecimal System All data in a computer is stored and moved around in binary format. This comprises of long sequences of 0 s and 1 s, which is actually very difficult for people to recognise and work with. We shall find that the hexadecimal format is very closely related to binary and offers a much more compact way of notating binary values. For example the binary string is written as B3DF in hexadecimal this is much easier to remember and to compare with other hex values (note that hexadecimal is often shortened to hex). The hexadecimal system has a base of 16, which implies that there are 16 hexadecimal digits. The first ten digits in the hex system are the same as in the decimal system, and the next six are represented using the letters from A to F. That is, the numbers from 0 to 9 are represented by the digits 0 to 9, and the numbers from 10 to 15 are represented by the digits A to F. denary hex A B C D E F Numbers larger than the decimal value 15 are represented using combinations of the 15 digits. The weight of each position in a hex number is a power of 16. This is illustrated for the first six positions, as follows: s 4096 s 256 s 16 s 1 s As an example, we shall determine the value of the hex number 3A in decimal. 3A 16 (3 x 16) + (10 x 1) = = The units column contains the hex digit A 16 which is 10 in decimal, the second column contains 3 and with a weight of 16 the value of this column is 3 x 16 which is 48. Adding the values of each column gives 58 which is the value of the hex number 3A. LCS, Edinburgh Page 5 of 17

6 As a second example, consider the hex number 11FF. 11FF 16 (1 x 16 3 ) + (1 x 16 2 ) + (15 x 16 1 ) + (15 x 1) = = Number Base Conversion It is sometimes necessary to convert numbers from one base to another. This is particularly true when working with microprocessors at the machine or system level. A computer user need not concern themselves with the conversion between bases as the computer has software to convert decimal input into the computer s own internal binary representation. Similarly the computer converts the binary results into decimal form before displaying them Decimal To Binary To convert a decimal number to binary, divide the number repeatedly by 2, and after each division record the remainder. The last division will always be a 1 divided by 2 (with result 0 remainder 1). The remainders will give the corresponding binary number. For example, convert 75 to binary format: r r r r r r r The result is read from the most significant bit (the last remainder) upwards to give LCS, Edinburgh Page 6 of 17

7 2.4.2 Decimal to Hex The same method as converting decimal to binary is used, except that the division is now by 16, not 2. That is, divide the number repeatedly by 16, and after each division record the remainder. The division stops after the division of the units digit. The remainders give the digits for the corresponding hex number. As an example, convert decimal 78 to a hex representation r 14 E in hex 0 r 4 4E Therefore E 16 Example 2. Convert decimal 827 to a hex representation r 11 ( B 16 ) 16 3 r 3 0 r 3 33B Therefore E Binary to Decimal As we have seen it is possible to convert a binary number to decimal by adding the values in each column. For example, is given by = = 106 There is a quicker method which requires some mental arithmetic. It proceeds as follows. Take the leftmost bit, double it and add it to the bit on its right. Now take this result, double it and add it to the next bit on its right. Repeat this process until the least significant bit has been added to the number. To illustrate we shall convert into denary. Write down the binary number and, starting at the most significant position (the leftmost column), carry its value right one position and double it, giving 2. LCS, Edinburgh Page 7 of 17

8 Add this to the value in this position (2 added to 1 giving 3). Now carry the 3 right one position and double it (giving 6), then add it to the value in this position (6 added to 1 giving 7). Again carry the result so far, 7, right one position and double it (giving 14), then add it to the value in this position (14 added to 0 gives 14). This is the units position, and so the number has been converted. Therefore Another example, to convert , Therefore Hex to Decimal This method is identical to the process for binary to decimal except that 16 is used as the multiplier. As an example, convert 3EF 16 to decimal. Therefore 3EF E F Of course, multiplication by 16 is not so easy, and you may wish to use the alternative method of calculating the value of each column in decimal and summing the results. As was previously stated, computers use the binary and hexadecimal systems and so conversion between these two systems is a useful skill to have. Fortunately these conversions are much simpler than the conversions to and from decimal Binary to Hexadecimal The method is to start at the unit column and convert each group of four bits into a corresponding hexadecimal digit As an example take LCS, Edinburgh Page 8 of 17

9 5 A 9 Therefore A9 16. As another example take E B Therefore EB 16. The ease of conversion is because four binary digits represent the same range of values as a single hexadecimal digit Hexadecimal to Binary This is the reverse process of converting from binary to hexadecimal. Take each hexadecimal digit and convert it to the corresponding binary representation. As an example take Therefore As another example take CBA 16 C B A Therefore CBA These last conversions highlight the reason for the use of the hexadecimal system: it is simply as an aid to human memory. A long sequence of binary digits, such as is almost impossible to remember and compare with another binary number. It is much easier to work with the equivalent hexadecimal value 44EB 16, The hexadecimal representation is much more compact and the conversion is an easy task. Because of this, hexadecimal is the preferred way of referring to memory addresses and their contents. Utilities, such as those used by computer engineers and programmers, to allow examination of memory locations etc. usually provide a display in hexadecimal rather than binary. Numbers in binary, may be made easier to read if they are written in groups of four bits. For example rather than dealing with , write it as We will stick to this particular format for binary from now on. LCS, Edinburgh Page 9 of 17

10 Consider the representation of some numbers in all three number systems: binary denary hexadecimal F FE E D2 A number in its binary representation will always contain at least the same or more digits than the decimal representation. Similarly the decimal representation will always contain at least the same or more digits than the hexadecimal representation. When the decimal and hexadecimal representation contain the same number of digits, the most significant digit in the hexadecimal representation will always be less than the most significant digit in the decimal representation (except for decimal 16,17, 18, 19). This may be used as a rough check when performing number system conversions. SAQ 2.3 Complete the following table. Binary Decimal Hex F 256 ABC 2.5 Binary Arithmetic Binary arithmetic follows exactly the same rules as decimal arithmetic. Since the binary digits are 0 and 1, the following binary tables contain all the possible combinations when adding or subtracting binary numbers. Addition Subtraction = = = = 1 borrow = = 1 LCS, Edinburgh Page 10 of 17

11 1 + 1 = 0 carry 1 (or 10) 1-1 = 0 With addition, all that needs to be remembered is that when adding two 1 s there will be a carry into the next column. Following are a few examples of addition. 1. Add Add space for carries 11 space for carries 100 (3+1=4) 110 (3+3=6) 3. Add Add space for carries 11 space for carries (15+1=16) (14+29=43) In examples 2 and 4, a carry into a column results in three 1 s to be added. The sum is 11, and this means, write down 1 as the result for the column, and carry 1 to the next column. It is very useful to be able to add binary numbers together, but it can take some practice. The only alternative is to convert the numbers to decimal, perform the addition, and convert back to decimal which involves much more work. LCS, Edinburgh Page 11 of 17

12 SAQ 2.4 Add the following binary numbers. 1) 2) 3) ) 5) 6) Subtraction can also be carried out as for decimal numbers, although, as we shall see later, a computer does not subtract numbers in this manner. However, it is still a useful skill to have. The method is covered in class. SAQ 2.5 Subtract the following binary numbers. 1) 2) 3) ) 5) 6) LCS, Edinburgh Page 12 of 17

13 2.5 Hexadecimal Arithmetic The rules are as for decimal arithmetic, except that any position in a hex number may contain a digit from 0 to F. Here are some examples of addition in hexadecimal. 1. Calculate 6E + D7 2. Calculate E 999 +D space for carries 11 space for carries 145 ( =325) 1221 (4-1=3) When adding hex numbers I find it easier to convert the digits being added into decimal, do the addition, and convert back to hex, taking any carry into the next position. For example in the first example above. First add E and 7, in decimal this is = in hex. Write down the 5 and carry 1. In the second column we now have D, which is = in hex. Write down the 4 and carry 1 to give a final result of LCS, Edinburgh Page 13 of 17

14 3. Calculate DEF Calculate B34 + 1A78 AEF 1A B34 11 space for carries 1 space for carries D78 ( =3448) 25AC ( =9644) We have already noted that hexadecimal is the preferred method of referring to memory addresses in computers. For example, the software necessary to drive a monitor may be described as using the memory from 2F4E00h to 3377F0h (the postfix h is used to indicate hexadecimal format). To find out how much memory the program requires, the hexadecimal figures must be subtracted. The subtraction would proceed as follows: F 0-2 F 4 E B F 0 Therefore the memory required is 42BF1h. Converting this to decimal, the program will occupy 273,393 bytes of memory, that is k. When subtracting hex numbers I would use the same technique as when adding. That is, convert the digits in the current position to decimal, perform the subtraction, and convert back to hex. Here are more examples of subtraction in hexadecimal. 1. Calculate D7-6E 2. Calculate 3E24 - FED D7 3E24-6E - FED ( =105) 2E37 ( =11831) LCS, Edinburgh Page 14 of 17

15 SAQ 2.6 Perform the following hexadecimal calculations as indicated. 1) 2) 3) 728 F466 AAAB +F8 +A22 +BBA 4) 5) 6) 728 F466 AAAB -F8 -A22 -BBA SAQ 2.7 Calculate the amount of memory taken up by a program starting at memory address F and ending at address AAAAA 16. Answers to SAQs SAQ 2.1 The base of a number system refers to the number of different symbols used to notate numbers. In base 2, these are 0 and 1 and are known as the binary digits. Numbers with values of 2 or higher are notated by using combinations of 0 and 1. LCS, Edinburgh Page 15 of 17

16 SAQ 2.2 The hex system has a base of 16. This means that there must be 16 digits available for representing numeric quantities. The first ten numbers are represented by using the symbols 0 to 9 (just as in the decimal system). The next 6 numbers (corresponding to the numbers 10 to 15 in decimal) must be assigned single digits. These are chosen to be the first six alphabetics A to F. The digits 0 to F are therefore the hex digits used to represent the first 16 numbers (0 to 15 in decimal), and all higher values are notated using combinations of these digits. SAQ 2.3 Binary Decimal Hex AA DD F F ABC SAQ 2.4 Binary additions. 1) 2) 3) ) 5) 6) LCS, Edinburgh Page 16 of 17

17 SAQ 2.5 Binary subtractions. 1) 2) 3) ) 5) 6) SAQ 2.6 Hexadecimal arithmetic. 1) 2) 3) 728 F466 AAAB +F8 +A22 +BBA 820 FE88 B665 4) 5) 6) 728 F466 AAAB -F8 -A22 -BBA 630 EA44 9EF1 SAQ 2.7 The calculation is AAAAA - F Note that 1 is added to the subtraction in order to include the memory start address in the calculation. This gives a result of 9B889 bytes. LCS, Edinburgh Page 17 of 17

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

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

More information

Base Conversion written by Cathy Saxton

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,

More information

Section 1.4 Place Value Systems of Numeration in Other Bases

Section 1.4 Place Value Systems of Numeration in Other Bases Section.4 Place Value Systems of Numeration in Other Bases Other Bases The Hindu-Arabic system that is used in most of the world today is a positional value system with a base of ten. The simplest reason

More information

Computer Science 281 Binary and Hexadecimal Review

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

More information

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

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

More information

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems This assignment is designed to familiarize you with different numbering systems, specifically: binary, octal, hexadecimal (and decimal)

More information

Binary, Hexadecimal, Octal, and BCD Numbers

Binary, Hexadecimal, Octal, and BCD Numbers 23CH_PHCalter_TMSETE_949118 23/2/2007 1:37 PM Page 1 Binary, Hexadecimal, Octal, and BCD Numbers OBJECTIVES When you have completed this chapter, you should be able to: Convert between binary and decimal

More information

NUMBER SYSTEMS. William Stallings

NUMBER SYSTEMS. William Stallings NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html

More information

Lecture 2. Binary and Hexadecimal 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

More information

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

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

More information

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Digital Logic II May, I before starting the today s lecture

More information

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

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

More information

Positional Numbering System

Positional Numbering System APPENDIX B Positional Numbering System A positional numbering system uses a set of symbols. The value that each symbol represents, however, depends on its face value and its place value, the value associated

More information

Decimal to Binary Conversion

Decimal to Binary Conversion Decimal to Binary Conversion A tool that makes the conversion of decimal values to binary values simple is the following table. The first row is created by counting right to left from one to eight, for

More information

NUMBER SYSTEMS. 1.1 Introduction

NUMBER SYSTEMS. 1.1 Introduction NUMBER SYSTEMS 1.1 Introduction There are several number systems which we normally use, such as decimal, binary, octal, hexadecimal, etc. Amongst them we are most familiar with the decimal number system.

More information

Binary Representation

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

More information

2 Number Systems. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

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

More information

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

More information

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011 CS101 Lecture 11: Number Systems and Binary Numbers Aaron Stevens 14 February 2011 1 2 1 3!!! MATH WARNING!!! TODAY S LECTURE CONTAINS TRACE AMOUNTS OF ARITHMETIC AND ALGEBRA PLEASE BE ADVISED THAT CALCULTORS

More information

CPEN 214 - Digital Logic Design Binary Systems

CPEN 214 - Digital Logic Design Binary Systems CPEN 4 - Digital Logic Design Binary Systems C. Gerousis Digital Design 3 rd Ed., Mano Prentice Hall Digital vs. Analog An analog system has continuous range of values A mercury thermometer Vinyl records

More information

Number Representation

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

More information

Number and codes in digital systems

Number and codes in digital systems Number and codes in digital systems Decimal Numbers You are familiar with the decimal number system because you use them everyday. But their weighted structure is not understood. In the decimal number

More information

Binary Numbers. Binary Octal Hexadecimal

Binary Numbers. Binary Octal Hexadecimal Binary Numbers Binary Octal Hexadecimal Binary Numbers COUNTING SYSTEMS UNLIMITED... Since you have been using the 10 different digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 all your life, you may wonder how

More information

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

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

More information

Useful Number Systems

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

More information

The Hexadecimal Number System and Memory Addressing

The Hexadecimal Number System and Memory Addressing APPENDIX C The Hexadecimal Number System and Memory Addressing U nderstanding the number system and the coding system that computers use to store data and communicate with each other is fundamental to

More information

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6 Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6 Number Systems No course on programming would be complete without a discussion of the Hexadecimal (Hex) number

More information

Systems I: Computer Organization and Architecture

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

More information

CSI 333 Lecture 1 Number Systems

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

More information

A Step towards an Easy Interconversion of Various Number Systems

A Step towards an Easy Interconversion of Various Number Systems A towards an Easy Interconversion of Various Number Systems Shahid Latif, Rahat Ullah, Hamid Jan Department of Computer Science and Information Technology Sarhad University of Science and Information Technology

More information

Chapter 2. Binary Values and Number Systems

Chapter 2. Binary Values and Number Systems Chapter 2 Binary Values and Number Systems Numbers Natural numbers, a.k.a. positive integers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative numbers A

More information

Chapter 4: Computer Codes

Chapter 4: Computer Codes Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence 36 Slide 2/30 Data

More information

NUMBER SYSTEMS APPENDIX D. You will learn about the following in this appendix:

NUMBER SYSTEMS APPENDIX D. You will learn about the following in this appendix: APPENDIX D NUMBER SYSTEMS You will learn about the following in this appendix: The four important number systems in computing binary, octal, decimal, and hexadecimal. A number system converter program

More information

6 The Hindu-Arabic System (800 BC)

6 The Hindu-Arabic System (800 BC) 6 The Hindu-Arabic System (800 BC) Today the most universally used system of numeration is the Hindu-Arabic system, also known as the decimal system or base ten system. The system was named for the Indian

More information

Numbering Systems. InThisAppendix...

Numbering Systems. InThisAppendix... G InThisAppendix... Introduction Binary Numbering System Hexadecimal Numbering System Octal Numbering System Binary Coded Decimal (BCD) Numbering System Real (Floating Point) Numbering System BCD/Binary/Decimal/Hex/Octal

More information

3. Convert a number from one number system to another

3. Convert a number from one number system to another 3. Convert a number from one number system to another Conversion between number bases: Hexa (16) Decimal (10) Binary (2) Octal (8) More Interest Way we need conversion? We need decimal system for real

More information

2011, The McGraw-Hill Companies, Inc. Chapter 3

2011, The McGraw-Hill Companies, Inc. Chapter 3 Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through

More information

Numeration systems. Resources and methods for learning about these subjects (list a few here, in preparation for your research):

Numeration systems. Resources and methods for learning about these subjects (list a few here, in preparation for your research): Numeration systems This worksheet and all related files are licensed under the Creative Commons Attribution License, version 1.0. To view a copy of this license, visit http://creativecommons.org/licenses/by/1.0/,

More information

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi) Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi) INTRODUCTION System- A number system defines a set of values to represent quantity. We talk about the number of people

More information

YOU MUST BE ABLE TO DO THE FOLLOWING PROBLEMS WITHOUT A CALCULATOR!

YOU MUST BE ABLE TO DO THE FOLLOWING PROBLEMS WITHOUT A CALCULATOR! DETAILED SOLUTIONS AND CONCEPTS - DECIMALS AND WHOLE NUMBERS Prepared by Ingrid Stewart, Ph.D., College of Southern Nevada Please Send Questions and Comments to ingrid.stewart@csn.edu. Thank you! YOU MUST

More information

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

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

More information

Lecture 11: Number Systems

Lecture 11: Number Systems Lecture 11: Number Systems Numeric Data Fixed point Integers (12, 345, 20567 etc) Real fractions (23.45, 23., 0.145 etc.) Floating point such as 23. 45 e 12 Basically an exponent representation Any number

More information

plc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

plc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums plc numbers - 3. Topics: Number bases; binary, octal, decimal, hexadecimal Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;

More information

Addition Methods. Methods Jottings Expanded Compact Examples 8 + 7 = 15

Addition Methods. Methods Jottings Expanded Compact Examples 8 + 7 = 15 Addition Methods Methods Jottings Expanded Compact Examples 8 + 7 = 15 48 + 36 = 84 or: Write the numbers in columns. Adding the tens first: 47 + 76 110 13 123 Adding the units first: 47 + 76 13 110 123

More information

THE BINARY NUMBER SYSTEM

THE BINARY NUMBER SYSTEM THE BINARY NUMBER SYSTEM Dr. Robert P. Webber, Longwood University Our civilization uses the base 10 or decimal place value system. Each digit in a number represents a power of 10. For example, 365.42

More information

Cyber Security Workshop Encryption Reference Manual

Cyber Security Workshop Encryption Reference Manual Cyber Security Workshop Encryption Reference Manual May 2015 Basic Concepts in Encoding and Encryption Binary Encoding Examples Encryption Cipher Examples 1 P a g e Encoding Concepts Binary Encoding Basics

More information

IBM Emulation Mode Printer Commands

IBM Emulation Mode Printer Commands IBM Emulation Mode Printer Commands Section 3 This section provides a detailed description of IBM emulation mode commands you can use with your printer. Control Codes Control codes are one-character printer

More information

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

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic: 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

More information

COMPSCI 210. Binary Fractions. Agenda & Reading

COMPSCI 210. Binary Fractions. Agenda & Reading COMPSCI 21 Binary Fractions Agenda & Reading Topics: Fractions Binary Octal Hexadecimal Binary -> Octal, Hex Octal -> Binary, Hex Decimal -> Octal, Hex Hex -> Binary, Octal Animation: BinFrac.htm Example

More information

Binary Adders: Half Adders and Full Adders

Binary Adders: Half Adders and Full Adders Binary Adders: Half Adders and Full Adders In this set of slides, we present the two basic types of adders: 1. Half adders, and 2. Full adders. Each type of adder functions to add two binary bits. In order

More information

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

More information

Data Representation. What is a number? Decimal Representation. Interpreting bits to give them meaning. Part 1: Numbers. six seis

Data Representation. What is a number? Decimal Representation. Interpreting bits to give them meaning. Part 1: Numbers. six seis Data Representation Interpreting bits to give them meaning Part 1: Numbers Notes for CSC 100 - The Beauty and Joy of Computing The University of North Carolina at Greensboro What is a number? Question:

More information

4.3 TABLE 3 TABLE 4. 1342 five 1 125 3 25 4 5 2 1 125 75 20 2 222.

4.3 TABLE 3 TABLE 4. 1342 five 1 125 3 25 4 5 2 1 125 75 20 2 222. .3 Conversion Between Number Bases 169.3 Conversion Between Number Bases Although the numeration systems discussed in the opening section were all base ten, other bases have occurred historically. For

More information

Guidance paper - The use of calculators in the teaching and learning of mathematics

Guidance paper - The use of calculators in the teaching and learning of mathematics Guidance paper - The use of calculators in the teaching and learning of mathematics Background and context In mathematics, the calculator can be an effective teaching and learning resource in the primary

More information

Goals. Unary Numbers. Decimal Numbers. 3,148 is. 1000 s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1

Goals. Unary Numbers. Decimal Numbers. 3,148 is. 1000 s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1 Number Bases //9 Goals Numbers Understand binary and hexadecimal numbers Be able to convert between number bases Understand binary fractions COMP37 Introduction to Computer Architecture Unary Numbers Decimal

More information

Fractions to decimals

Fractions to decimals Worksheet.4 Fractions and Decimals Section Fractions to decimals The most common method of converting fractions to decimals is to use a calculator. A fraction represents a division so is another way of

More information

Today s topics. Digital Computers. More on binary. Binary Digits (Bits)

Today s topics. Digital Computers. More on binary. Binary Digits (Bits) Today s topics! Binary Numbers! Brookshear.-.! Slides from Prof. Marti Hearst of UC Berkeley SIMS! Upcoming! Networks Interactive Introduction to Graph Theory http://www.utm.edu/cgi-bin/caldwell/tutor/departments/math/graph/intro

More information

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology LSN 2 Number Systems Department of Engineering Technology LSN 2 Decimal Number System Decimal number system has 10 digits (0-9) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 10-1 10-2 10-3

More information

CS201: Architecture and Assembly Language

CS201: Architecture and Assembly Language CS201: Architecture and Assembly Language Lecture Three Brendan Burns CS201: Lecture Three p.1/27 Arithmetic for computers Previously we saw how we could represent unsigned numbers in binary and how binary

More information

Counting in base 10, 2 and 16

Counting in base 10, 2 and 16 Counting in base 10, 2 and 16 1. Binary Numbers A super-important fact: (Nearly all) Computers store all information in the form of binary numbers. Numbers, characters, images, music files --- all of these

More information

JobTestPrep's Numeracy Review Decimals & Percentages

JobTestPrep's Numeracy Review Decimals & Percentages JobTestPrep's Numeracy Review Decimals & Percentages 1 Table of contents What is decimal? 3 Converting fractions to decimals 4 Converting decimals to fractions 6 Percentages 6 Adding and subtracting decimals

More information

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1 UNIT 22: PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1 This work covers part of outcome 2 of the Edexcel standard module. The material is

More information

47 Numerator Denominator

47 Numerator Denominator JH WEEKLIES ISSUE #22 2012-2013 Mathematics Fractions Mathematicians often have to deal with numbers that are not whole numbers (1, 2, 3 etc.). The preferred way to represent these partial numbers (rational

More information

Basic numerical skills: FRACTIONS, DECIMALS, PROPORTIONS, RATIOS AND PERCENTAGES

Basic numerical skills: FRACTIONS, DECIMALS, PROPORTIONS, RATIOS AND PERCENTAGES Basic numerical skills: FRACTIONS, DECIMALS, PROPORTIONS, RATIOS AND PERCENTAGES. Introduction (simple) This helpsheet is concerned with the ways that we express quantities that are not whole numbers,

More information

Decimals and other fractions

Decimals and other fractions Chapter 2 Decimals and other fractions How to deal with the bits and pieces When drugs come from the manufacturer they are in doses to suit most adult patients. However, many of your patients will be very

More information

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal: Exercises 1 - number representations Questions 1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal: (a) 3012 (b) - 435 2. For each of

More information

Part 1 Expressions, Equations, and Inequalities: Simplifying and Solving

Part 1 Expressions, Equations, and Inequalities: Simplifying and Solving Section 7 Algebraic Manipulations and Solving Part 1 Expressions, Equations, and Inequalities: Simplifying and Solving Before launching into the mathematics, let s take a moment to talk about the words

More information

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 1 Number Systems Representation Positive radix, positional number systems A number with radix r is represented by a string of digits: A n

More information

Lecture 4: Binary. CS442: Great Insights in Computer Science Michael L. Littman, Spring 2006. I-Before-E, Continued

Lecture 4: Binary. CS442: Great Insights in Computer Science Michael L. Littman, Spring 2006. I-Before-E, Continued Lecture 4: Binary CS442: Great Insights in Computer Science Michael L. Littman, Spring 26 I-Before-E, Continued There are two ideas from last time that I d like to flesh out a bit more. This time, let

More information

Welcome to Basic Math Skills!

Welcome to Basic Math Skills! Basic Math Skills Welcome to Basic Math Skills! Most students find the math sections to be the most difficult. Basic Math Skills was designed to give you a refresher on the basics of math. There are lots

More information

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın Digital Design Assoc. Prof. Dr. Berna Örs Yalçın Istanbul Technical University Faculty of Electrical and Electronics Engineering Office Number: 2318 E-mail: siddika.ors@itu.edu.tr Grading 1st Midterm -

More information

Numeracy Preparation Guide. for the. VETASSESS Test for Certificate IV in Nursing (Enrolled / Division 2 Nursing) course

Numeracy Preparation Guide. for the. VETASSESS Test for Certificate IV in Nursing (Enrolled / Division 2 Nursing) course Numeracy Preparation Guide for the VETASSESS Test for Certificate IV in Nursing (Enrolled / Division Nursing) course Introduction The Nursing course selection (or entrance) test used by various Registered

More information

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory. 1 Topics Machine Architecture and Number Systems Major Computer Components Bits, Bytes, and Words The Decimal Number System The Binary Number System Converting from Decimal to Binary Major Computer Components

More information

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions. Unit 1 Number Sense In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions. BLM Three Types of Percent Problems (p L-34) is a summary BLM for the material

More information

Playing with Numbers

Playing with Numbers PLAYING WITH NUMBERS 249 Playing with Numbers CHAPTER 16 16.1 Introduction You have studied various types of numbers such as natural numbers, whole numbers, integers and rational numbers. You have also

More information

Number Systems and Radix Conversion

Number Systems and Radix Conversion Number Systems and Radix Conversion Sanjay Rajopadhye, Colorado State University 1 Introduction These notes for CS 270 describe polynomial number systems. The material is not in the textbook, but will

More information

We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: 9081 + 900b + 90c = 9001 + 100c + 10b

We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: 9081 + 900b + 90c = 9001 + 100c + 10b In this session, we ll learn how to solve problems related to place value. This is one of the fundamental concepts in arithmetic, something every elementary and middle school mathematics teacher should

More information

Memory is implemented as an array of electronic switches

Memory is implemented as an array of electronic switches Memory Structure Memory is implemented as an array of electronic switches Each switch can be in one of two states 0 or 1, on or off, true or false, purple or gold, sitting or standing BInary digits (bits)

More information

Computation Strategies for Basic Number Facts +, -, x,

Computation Strategies for Basic Number Facts +, -, x, Computation Strategies for Basic Number Facts +, -, x, Addition Subtraction Multiplication Division Proficiency with basic facts aids estimation and computation of multi-digit numbers. The enclosed strategies

More information

Preliminary Mathematics

Preliminary Mathematics Preliminary Mathematics The purpose of this document is to provide you with a refresher over some topics that will be essential for what we do in this class. We will begin with fractions, decimals, and

More information

APPENDIX B. Routers route based on the network number. The router that delivers the data packet to the correct destination host uses the host ID.

APPENDIX B. Routers route based on the network number. The router that delivers the data packet to the correct destination host uses the host ID. APPENDIX B IP Subnetting IP Addressing Routers route based on the network number. The router that delivers the data packet to the correct destination host uses the host ID. IP Classes An IP address is

More information

Solve addition and subtraction word problems, and add and subtract within 10, e.g., by using objects or drawings to represent the problem.

Solve addition and subtraction word problems, and add and subtract within 10, e.g., by using objects or drawings to represent the problem. Solve addition and subtraction word problems, and add and subtract within 10, e.g., by using objects or drawings to represent the problem. Solve word problems that call for addition of three whole numbers

More information

Number Systems. Introduction / Number Systems

Number Systems. Introduction / Number Systems Number Systems Introduction / Number Systems Data Representation Data representation can be Digital or Analog In Analog representation values are represented over a continuous range In Digital representation

More information

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example BCD (ASCII) Arithmetic We will first look at unpacked BCD which means strings that look like '4567'. Bytes then look like 34h 35h 36h 37h OR: 04h 05h 06h 07h x86 processors also have instructions for packed

More information

2.3 IPv4 Address Subnetting Part 2

2.3 IPv4 Address Subnetting Part 2 .3 IPv4 Address Subnetting Part Objective Upon completion of this activity, you will be able to determine subnet information for a given IP address and subnetwork mask. When given an IP address, network

More information

Solution for Homework 2

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

More information

The Crescent Primary School Calculation Policy

The Crescent Primary School Calculation Policy The Crescent Primary School Calculation Policy Examples of calculation methods for each year group and the progression between each method. January 2015 Our Calculation Policy This calculation policy has

More information

Maths Workshop for Parents 2. Fractions and Algebra

Maths Workshop for Parents 2. Fractions and Algebra Maths Workshop for Parents 2 Fractions and Algebra What is a fraction? A fraction is a part of a whole. There are two numbers to every fraction: 2 7 Numerator Denominator 2 7 This is a proper (or common)

More information

Lies My Calculator and Computer Told Me

Lies My Calculator and Computer Told Me Lies My Calculator and Computer Told Me 2 LIES MY CALCULATOR AND COMPUTER TOLD ME Lies My Calculator and Computer Told Me See Section.4 for a discussion of graphing calculators and computers with graphing

More information

Unsigned Conversions from Decimal or to Decimal and other Number Systems

Unsigned Conversions from Decimal or to Decimal and other Number Systems Page 1 of 5 Unsigned Conversions from Decimal or to Decimal and other Number Systems In all digital design, analysis, troubleshooting, and repair you will be working with binary numbers (or base 2). It

More information

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

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

More information

Decimal Notations for Fractions Number and Operations Fractions /4.NF

Decimal Notations for Fractions Number and Operations Fractions /4.NF Decimal Notations for Fractions Number and Operations Fractions /4.NF Domain: Cluster: Standard: 4.NF Number and Operations Fractions Understand decimal notation for fractions, and compare decimal fractions.

More information

CS321. Introduction to Numerical Methods

CS321. Introduction to Numerical Methods CS3 Introduction to Numerical Methods Lecture Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 40506-0633 August 7, 05 Number in

More information

Chapter 1. Binary, octal and hexadecimal numbers

Chapter 1. Binary, octal and hexadecimal numbers Chapter 1. Binary, octal and hexadecimal numbers This material is covered in the books: Nelson Magor Cooke et al, Basic mathematics for electronics (7th edition), Glencoe, Lake Forest, Ill., 1992. [Hamilton

More information

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS Systems of Equations and Matrices Representation of a linear system The general system of m equations in n unknowns can be written a x + a 2 x 2 + + a n x n b a

More information

Intel Hexadecimal Object File Format Specification Revision A, 1/6/88

Intel Hexadecimal Object File Format Specification Revision A, 1/6/88 Intel Hexadecimal Object File Format Specification Revision A, 1/6/88 DISCLAIMER Intel makes no representation or warranties with respect to the contents hereof and specifically disclaims any implied warranties

More information

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) 1 COMPUTER LANGUAGES In order for a computer to be able to execute a program, the program must first be present

More information

Sunny Hills Math Club Decimal Numbers Lesson 4

Sunny Hills Math Club Decimal Numbers Lesson 4 Are you tired of finding common denominators to add fractions? Are you tired of converting mixed fractions into improper fractions, just to multiply and convert them back? Are you tired of reducing fractions

More information

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic Today Binary addition Representing negative numbers 2 Binary Addition Consider the following binary numbers: 0 0 1 0 0 1 1 0 0 0 1 0 1 0 1 1 How do we add these numbers? 3 Binary Addition 0 0 1 0 0 1 1

More information

The use of binary codes to represent characters

The use of binary codes to represent characters The use of binary codes to represent characters Teacher s Notes Lesson Plan x Length 60 mins Specification Link 2.1.4/hi Character Learning objective (a) Explain the use of binary codes to represent characters

More information