Beyond Base 10: Non-decimal Based Number Systems

Similar documents
Beyond Base 10: Non-decimal Based Number Systems

Objectives. Connecting with Computer Science 2

Number representations

Digital Fundamentals

MACHINE LEVEL REPRESENTATION OF DATA

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

CHW 261: Logic Design

The type of all data used in a C++ program must be specified

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.

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

Chapter 2. Data Representation in Computer Systems

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

COE 202- Digital Logic. Number Systems II. Dr. Abdulaziz Y. Barnawi COE Department KFUPM. January 23, Abdulaziz Barnawi. COE 202 Logic Design

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts. Chapter Overview. Welcome to Assembly Language

The. Binary. Number System

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

9/23/15. Agenda. Goals of this Lecture. For Your Amusement. Number Systems and Number Representation. The Binary Number System

Review of Number Systems

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

umber Systems bit nibble byte word binary decimal

Final Labs and Tutors

CS & IT Conversions. Magnitude 10,000 1,

in this web service Cambridge University Press

Electronic Data and Instructions

CMPS 10 Introduction to Computer Science Lecture Notes

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

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

Chapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

ECOM 2325 Computer Organization and Assembly Language. Instructor: Ruba A.Salamah INTRODUCTION

Number Systems Base r

Digital Computers and Machine Representation of Data

COMP Overview of Tutorial #2

Number codes nibble byte word double word

Chapter 1 Preliminaries

COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems

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

Level ISA3: Information Representation

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Moodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System

Binary Representation. Jerry Cain CS 106AJ October 29, 2018 slides courtesy of Eric Roberts

Introduction to Numbering Systems

Inf2C - Computer Systems Lecture 2 Data Representation

NUMERIC SYSTEMS USED IN NETWORKING

Digital Fundamentals

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

Chapter 3 DATA REPRESENTATION

A. Incorrect! To simplify this expression you need to find the product of 7 and 4, not the sum.

The type of all data used in a C (or C++) program must be specified

Chapter 2 Bits, Data Types, and Operations

Introduction to Computers and Programming. Numeric Values

Introduction to Informatics

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Octal & Hexadecimal Number Systems. Digital Electronics

Princeton University Computer Science 217: Introduction to Programming Systems. Goals of this Lecture. Number Systems and Number Representation

Chapter Overview. Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 1: Basic Concepts. Printing this Slide Show

Data Representation 1

COMP2121: Microprocessors and Interfacing. Number Systems

CHAPTER 2 Number Systems

Number Systems and Number Representation

Module 3: Representing Values in a Computer

Number Systems CHAPTER Positional Number Systems

2 Number Systems 2.1. Foundations of Computer Science Cengage Learning

Bits. Binary Digits. 0 or 1

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

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit

Number Systems. Dr. Tarek A. Tutunji Philadelphia University, Jordan

TOPICS. Other Number Systems. Other Number Systems 9/9/2017. Octal Hexadecimal Number conversion

Chapter 2 Binary Values and Number Systems

DATA REPRESENTATION. By- Neha Tyagi PGT CS KV 5 Jaipur II Shift, Jaipur Region. Based on CBSE curriculum Class 11. Neha Tyagi, KV 5 Jaipur II Shift

Programming Concepts and Skills. ASCII and other codes

Chapter 2 Bits, Data Types, and Operations

Fundamentals of Programming (C)

Lecture 2: Number Systems

CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems

Appendix 2 Number Representations

CHAPTER 2 - DIGITAL DATA REPRESENTATION AND NUMBERING SYSTEMS

Intermediate Programming & Design (C++) Notation

Conversion Between Number Bases

Unit 3. Analog vs. Digital. Analog vs. Digital ANALOG VS. DIGITAL. Binary Representation

CPS 104 Computer Organization and Programming Lecture-2 : Data representations,

Number Systems. Both numbers are positive

Chapter 1 Review of Number Systems

EE 109 Unit 3. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

Digital Systems COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

Representing Information. Bit Juggling. - Representing information using bits - Number representations. - Some other bits - Chapters 1 and 2.3,2.

Computer Science 1000: Part #3. Binary Numbers

Decimal/Binary Conversion on the Soroban

Chapter 2 Bits, Data Types, and Operations

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

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

MC1601 Computer Organization

Logic Circuits I ECE 1411 Thursday 4:45pm-7:20pm. Nathan Pihlstrom.

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

Logic and Computer Design Fundamentals. Chapter 1 Digital Computers and Information

Fundamentals of Programming Session 2

Integers and Rational Numbers

Internal Data Representation

Transcription:

Beyond Base : Non-decimal Based Number Systems What is the decimal based number system? How do other number systems work (binary, octal and hex) How to convert to and from nondecimal number systems to decimal math Base unique symbols are used to represent values : What Is Decimal? The number of digits is based on the number of digits The largest decimal value that can be represented by a single decimal digit is = base() - Table Of Values Base two value value Employs two unique symbols ( and ) Largest decimal value that can be represented by binary digit = = base() - Why Bother With? Representing Information: ASCII Representing information ASCII (American Standard Code for Information Interchange) Unicode It's the language of the computer Decimal - ASCII Invisible (control characters) Punctuation, mathematical operations Characters - Comparators and other miscellaneous characters : ;? @ - Alphabetic (upper case A - Z) More miscellaneous characters [ \ ] ^ _ ' Alphabetic (lower case a - z) - More miscellaneous characters { } ~ DEL

Representing Information: ASCII () Uses bits to represent characters Max number of possibilities = = characters that can be represented Representing Information: Unicode Uses bits (or more) to represent information Max number of possibilities = = characters that can be represented (more if more bits are used) e.g., 'A' is in decimal or in binary. In memory it looks like this: Computer Programs is the language of the computer Base eight Octal Employs eight unique symbols ( - ) ) A programmer writes a computer program ) The compiler translates the program into a form that the computer can understand ) An executable program is created. Anybody who has this executable installed on their computer can then run (use) it. Largest decimal value that can be represented by octal digit = = base() - Table Of Octal Values Uses Of Octal (Assembly Language) Octal value Octal value Machine Octal PDP - assembly language value language MOV #, R MOV (R), R Example from Introduction to the PDP- and its Assembly Language by Frank T.

Hexadecimal (Hex) Table of Hex Values Base sixteen Employs sixteen unique symbols (, followed by A - F) Largest decimal value that can be represented by hex digit = Hexadecimal value Hexadecimal value A B C D E F Uses Of Hexadecimal (Assembly Language) Summary (Decimal,, Octal, Hex) Decimal Octal Hex Decimal Octal Hex Machine Hexadecimal X assembly language value language C MOV.B D, (A)+ E BRA NEXT A B C D E F Example from Family Assembly Language by Clements A. High Vs. Low Level Overflow: A Real World Example People languages E.g., English, French, Spanish, Chinese, German etc. High level You can only represent a finite number of values High level programming language E.g., Pascal, Java, C++ Low level programming language Assembly Machine language Computer hardware Low level

Overflow: Occurs when you don't have enough bits to represent a value ( wraps around to zero) ( bit) Value ( bits) Value : : : : Value ( bits) Base N Employs N unique symbols Arbitrary Number Bases Largest decimal value that can be represented by digit = Base (N) - : : Converting Between Different Number Systems to/from octal to/from hexadecimal Octal to/from hexadecimal Decimal to any base Any base to decimal To Octal binary digits equals one octal digit (remember =) Form groups of three starting at the decimal For the integer portion start grouping at the decimal and go left For the fractional portion start grouping at the decimal and go right e.g. =???. Octal To octal digit equals = binary digits Split into groups of three starting at the decimal For the integer portion start splitting at the decimal and go left For the fractional portion start splitting at the decimal and go right To Hexadecimal binary digits equals one hexadecimal digit (remember =) Form groups of four at the decimal For the integer portion start grouping at the decimal and go left For the fractional portion start grouping at the decimal and go right e.g.. =??? e.g.,. =???..

Hexadecimal To hex digit equals = binary digits Split into groups of four starting at the decimal For the integer portion start splitting at the decimal and go left For the fractional portion start splitting at the decimal and go right e.g., A. =??? Convert to binary first! e.g., to???. Octal To Hexadecimal. Octal To Hexadecimal Hexadecimal To Octal Convert to binary first! e.g., to??? e.g., to??? Add any leading zeros that are needed (in this case two). Regroup in groups of... e.g., to???.. Hexadecimal To Octal Add any leading zeros that are needed (in this case one). Regroup in groups of Decimal To Any Base Split up the integer and the fractional portions ) For the integer portion: a. Divide the integer portion of the decimal number by the target base. b. The remainder becomes the first integer digit of the number in the target base. c. The quotient becomes the new integer value. d. Divide the new integer value by the target base. e. The new remainder becomes the second integer digit of the converted number. f. Continue dividing until the quotient is less than the target base and this quotient becomes the last integer digit of the converted number.

Decimal To Any Base () ) For the fractional portion: a. Multiply by the target base. b. The integer portion (if any) of the product becomes the first rational digit of the converted number. c. The non-rational portion of the product is then multiplied by the target base. d. The integer portion (if any) of the new product becomes the second rational digit of the converted number. e. Keep multiplying by the target base until either the resulting product equals zero or you have the desired number of places of precision. e.g., to??? / : q = r = / : q = r = /: q = r = Decimal To Any Base (). Stop dividing! (quotient less than target base) Any Base To Decimal Multiply each digit by the base raised to some exponent and sum the resulting products. - - - Position of digits i.e. d d d d. d d d b Number to be converted Base = b Value in decimal = (digit*b ) + (digit*b ) + (digit*b ) + (digit*b ) + (digit*b - ) + (digit*b - ) + (digit*b - ) e.g., to??? Any Base To Decimal () Position of the digits. Number to be converted Base = Value in decimal = (* ) + (* ) = (*) + (*) = + = The value of this exponent will be determined by the position of the digit. Addition In : Five Cases Addition In : Five Cases () Case : sum =, no carry out + Case : sum =, no carry out + Case : Sum =, Carry out = + + = (in decimal) = (in binary) + Case : sum =, no carry out + Case : sum, carry out = + = (in decimal) + = (in binary)

Subtraction In ( cases) You Should Now Know Case : - Case : - Case : - Case : - The amount that you borrow equals the base Decimal: Borrow : Borrow What is meant by a number base. How binary, octal and hex based number systems work and what role they play in the computer. What is overflow, why does it occur and when does it occur. How to/from convert between non-decimal based number systems and decimal. How to perform simple binary math (addition and subtraction).