DIT250 / BIT180 - MATHEMATICS. Number Bases. Decimal numbers (base ten), Decimal numbers (base ten), Decimal numbers (base ten), 3/24/2014

Similar documents
Base Conversion written by Cathy Saxton

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

CSI 333 Lecture 1 Number Systems

Section 1.4 Place Value Systems of Numeration in Other Bases

Binary Numbers. Binary Octal Hexadecimal

Decimal to Binary Conversion

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

Lecture 11: Number Systems

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

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

Memory is implemented as an array of electronic switches

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

Binary, Hexadecimal, Octal, and BCD Numbers

NUMBER SYSTEMS. 1.1 Introduction

Unsigned Conversions from Decimal or to Decimal and other Number Systems

3. Convert a number from one number system to another

Chapter 4: Computer Codes

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

THE BINARY NUMBER SYSTEM

=

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

Useful Number Systems

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.

A Step towards an Easy Interconversion of Various Number Systems

6 The Hindu-Arabic System (800 BC)

Number Systems and Radix Conversion

Positional Numbering System

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

Number and codes in digital systems

Lecture 2. Binary and Hexadecimal Numbers

Systems I: Computer Organization and Architecture

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

Counting in base 10, 2 and 16

Number of bits needed to address hosts 8

Cyber Security Workshop Encryption Reference Manual

COMPSCI 210. Binary Fractions. Agenda & Reading

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

Lesson Plan. Course Title: Computer Maintenance Session Title: Numbering Systems

Chapter 2. Binary Values and Number Systems

Chapter Binary, Octal, Decimal, and Hexadecimal Calculations

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

CPEN Digital Logic Design Binary Systems

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

Computer Science 281 Binary and Hexadecimal Review

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

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

Prerequisite knowledge Students should have a good understanding of how our decimal number system works as well as understand place value.

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

NUMBER SYSTEMS. William Stallings

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

Subnetting Examples. There are three types of subnetting examples I will show in this document:

HOMEWORK # 2 SOLUTIO

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Copyright 2012 Pearson Education, Inc. Chapter 1 INTRODUCTION TO COMPUTING AND ENGINEERING PROBLEM SOLVING

The Answer to the 14 Most Frequently Asked Modbus Questions

Numbering Systems. InThisAppendix...

Binary Number System. 16. Binary Numbers. Base 10 digits: Base 2 digits: 0 1

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

The Hexadecimal Number System and Memory Addressing

4.3 TABLE 3 TABLE five

CS201: Architecture and Assembly Language

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

3 SOFTWARE AND PROGRAMMING LANGUAGES

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

Lab 17: Building a 4-Digit 7-Segment LED Decoder

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

Japanese Character Printers EPL2 Programming Manual Addendum

Programming Exercises

COMBINATIONAL CIRCUITS

Number Systems. Introduction / Number Systems

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

EE360: Digital Design I Course Syllabus

Upon completion of unit 1.1, students will be able to

CS321. Introduction to Numerical Methods

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

Traditional IBM Mainframe Operating Principles

IT:101 Cisco Networking Academy I Subnetting

Binary Representation

IBM Emulation Mode Printer Commands

The programming language C. sws1 1

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

The use of binary codes to represent characters

Chapter 1: Digital Systems and Binary Numbers

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

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

Number Representation

River Dell Regional School District. Computer Programming with Python Curriculum

A Comparison of Student Learning in an Introductory Logic Circuits Course: Traditional Face-to-Face vs. Fully Online

MATHS ACTIVITIES FOR REGISTRATION TIME

Chapter 1. Binary, octal and hexadecimal numbers

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

Teaching Pre-Algebra in PowerPoint

Decimal Number (base 10) Binary Number (base 2)

Sequences. A sequence is a list of numbers, or a pattern, which obeys a rule.

Electronics Merit Badge Class 3. 1/30/2014 Electronics Merit Badge Class 3 1

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

Technical Support Bulletin Nr.18 Modbus Tips

Chapter 5. Binary, octal and hexadecimal numbers

Introduction to Computer & Information Systems

Ch. 10 Software Development. (Computer Programming)

Transcription:

DIT250 / BIT180 - MATHEMATICS ASSESSMENT CA 40% 3 TESTS EXAM 60% LECTURE SLIDES www.lechaamwe.weebly.com Lecture notes DIT250/BIT180 Number Bases In this lesson we shall discuss different Number Bases, specifically those used by the computer These include: decimal numbers (base ten) binary numbers (base two) octal numbers (base eight) Hexadecimal numbers (base sixteen) Decimal numbers (base ten), Numbers used by humans to quantify items It s called base ten because? Symbols used 0,1,2,3,4,5,6,7,8 and 9 To count in base ten, you go from 0 to 9, then do combinations of two digits starting with 10 all the way to 99 Decimal numbers (base ten), After 99 comes three-digit combinations from 100 999, etc. This combination system is true for any base you use. The only difference is how many digits you have before you go to the next combination Decimal numbers (base ten), Have place values of powers of ten Eg 1 246 10 2 place value - 10 2 4 place value 10 1 6 place value 10 0 Decimal numbers (base ten), Eg 2 46.57 10 4 place value - 10 1 6 place value 10 0 5 place value 10-1 5 place value 10-2 1

Binary numbers (base two) Numbers used and understood by computers Symbols used 0 and 1 To count in base two, you count 0,1, then switch to two digit combinations, 10,11, then to three digit combos, 100, 101,110,111, then four digit, 1000,,,, 1111 Binary numbers (base two) Have place values of powers of two Eg 1 110 2 1 place value - 2 2 1 place value 2 1 0 place value 2 0 Binary numbers (base two) Eg 2 11.10 10 1 place value - 2 1 1 place value 2 0 1 place value 2-1 0 place value 2-2 Octal numbers (base eight), Numbers used by machine language programmers as short hand for binary numbers Three binary digits are equivalent to 1 octal digit Eg 6 8 110 2 Symbols used 0, 1, 2, 3, 4,5, 6 and 7 Octal numbers (base eight), Here is the base eight counting sequence 0,1,2,3,4,5,6,7,10,11,12,13, 77 100,101,102,103,104,105,106,1 07 110,111, etc. Octal numbers (base eight), Have place values of powers of eight Eg 1 456 8 4 place value - 8 2 5 place value 8 1 6 place value 8 0 2

Octal numbers (base eight), Eg 2 34.56 8 3 place value - 8 1 4 place value 8 0 5 place value 8-1 6 place value 8-2 Hexadecimal numbers (base sixteen) Numbers used by machine and assembly language programmers to help simply low level programming Four binary digits are equivalent to 1 octal digit Eg 9 16 1001 2 Symbols used 0, 1, 2, 3, 4,5, 6,7,8,9,10, 11, 12, 13,14 and 15 Symbols 10, 11, 12, 13, 14 and 15 replaced by letters A, B, C, D, E and F respectively Hexadecimal numbers (base sixteen) Hexadecimal numbers (base sixteen) Here s the single digit sequence for base sixteen: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Then the two-digit combos: 10,11,12, 19,1A,1B,1C,1D,1E,1F,20, 21,22, 2D,2E,2F,30,31, FF Have place values of powers of sixteen Eg 1 A79 16 A place value - 16 2 7 place value 16 1 9 place value 16 0 Hexadecimal numbers (base sixteen) Eg 2 E6.A8 16 E place value - 16 1 6 place value 16 0 A place value 16-1 8 place value 16-2 Base conversion To convert from base ten to another base, such as base two, eight, or sixteen, is an important skill for computer scientists and programmers. The next section shows how to do this. 18 3

Let s take the value 27 and convert it into base 2. Here s the process: Divide 27 by 2 The answer is 13, remainder 1 Divide 13 by 2 Answer is 6, remainder 1 Continue until the answer is 1. 6 divided by 2 = 3, remainder 0 3 divided by 2 = 1, remainder 1 20 Now take the last answer, 1, and all of the remainders in reverse order, and put them together 11011 27 base 10 = 11011 base two Here s an easy way to do it on paper 27 divided by 2 = 13, R 1 22 13 / 2 = 6, R 1 6 / 2 = 3, R 0 23 24 4

3 / 2 = 1, R 1 Stop, and write the answer 25 26 Base 2 to base 10 Use place values to convert. Eg1. Convert 11011 2 to Base 10 1 1 0 1 1 2 4 2 3 2 2 2 1 2 0 16x1 8x1 4x0 2x1 1x1 16+ 8+ 0+ 2+ 1 27 =27 10 Base 2 to base 10 Eg2. Convert 1111.101 2 to Base 10 1 1 1 1. 1 0 1 7 8 11+7/8 11 2 3 2 2 2 1 2 0. 2-1 2-2 2-3 8x1 4x1 2x1 1x1. 1/2 0 1/8 8+ 4+ 2+ 1+ ½+ 0+ 1/8 =15.625 Base Ten to Base Eight Let s again take the value 27 and convert it into base 8. Same process: Divide 27 by 8 The answer is 3, remainder 3 Stop! You can t divide anymore because the answer is less than 8 30 5

Base Ten to Base Eight The last answer was 3, and the only remainder was 3, so the base eight value is 33, base 8. Base Ten to Base Eight Use the same method on paper 27 divided by 8 = 3, R 3 27, base 10 = 33, base 8 31 32 Base 8 to Base 10 Use place values to convert Eg 1 Covert 2657 8 to Base 10 2 6 5 7 8 3 8 2 8 1 8 0 512x2 64x6 8x5 1x8 1024+ 384+ 40+ 8+ 1456 10 Base 8 to Base 10 Eg2 Covert 327.24 8 to Base 10 3 2 7. 2 4 8 2 8 1 8 0 8-1 8-2 64x3 8x2 1x7 1/8x2 1/64 x 4 192+ 16+ 7+ ¼+ 1/16 =215+5/16 =215.3125 Exercises Now try the same values for base eight. 6. 16 10 = 8 7. 47 10 = 8 8. 145 10 = 8 9. 31 10 = 8 10.32 10 = 8 Base Ten to Base Sixteen Finally we ll convert 27 into base 16. Divide 27 by 16 The answer is 1, remainder 11 Stop! You can t divide anymore because the answer is less than 16 35 36 6

Base Ten to Base Sixteen The last answer was 1, and the only remainder was 11, which in base 16 is the letter B, so the base sixteen value is 1B, base 16. Base Ten to Base Sixteen Again, the same method on paper 27 divided by 16 = 1, R 11 or B 27, base 10 = 1B, base 16 37 38 Base 16 to Base 10 E.g Covert 12AE 16 to base 10 EG 2, Convert 62A.48 16 TO BASE 10 1 2 A E 16 3 16 2 16 1 16 0 4096x1 256x2 16x10 1x 15 4096+ 512+ 160+ 15 =4783 10 6 2 A. 4 8 16 2 16 1 16 0 16-1 16-2 256x6 16x2 1x10 1/16x4 1/256 x 4 1536+ 32+ 10+ ¼+ 1/32 =1578+9/32 =1578.2812 Convert from Base 2 to Base 8 Using the fact that 3 binary digits are equivalent to one octal digit. Eg1. Convert 1001110011 Group the bits in 3s beginning with the least significant bit 001 001 110 011 Convert the individual groups to base 10. Ie 001 = 1 001 = 1 110 = 6 011 = 3 Therefore 1001110011 2 equivalent to 1163 10 Convert from Base 2 to Base 8 Eg2. Convert 1110011.01101 2 Group the bits in 3s beginning from the decimal point 001 110 011.011 010 2 Ie 001 = 1 110 = 6 011 =3 011=3 010 =2 Therefore 1110011.01101 2 = 163.32 10 7

Convert from Base 8 to Base 2 Using the similar fact that 3 binary digits are equivalent to one octal digit and convert individual digits to base 2 and form groups of 3. Eg 1 convert 6752 8 to base 2 6 = 110 7 = 111 5 = 101 2 = 010 Therefore 6752 8 = 110111101010 2 Convert from Base 8 to Base 2 Eg. 2, Convert 435.465 8 to base 2 4 = 100 3 = 011 5 = 101 4=100 6 = 110 5 =101 Therefore 435.465 8 = 100011101.100110101 2 Convert from Base 2 to Base 16 Using the fact that 4 binary digits are equivalent to one hex digit. Eg1. Convert 100111001111 Group the bits in 4s beginning with the least significant bit. 1001 1100 1111 1001 = 9 1100 = 12 = C 1111 = 15 =F Therefore = 100111001111 2 = 9CF 16 Convert from Base 2 to Base 16 Eg2. Convert 111001111.01110101 2 Group the bits in 4s beginning from the decimal point 111001111.01110101 2 0001 1100 1111. 0111 0101 0001 = 1 1100 = 12 = C 1111 = 15 = F 0111 = 7 0101 = 5 Therefore 111001111.01110101 2 = 1CF.75 16 8