Integer Numbers. The Number Bases of Integers Textbook Chapter 3

Size: px
Start display at page:

Download "Integer Numbers. The Number Bases of Integers Textbook Chapter 3"

Transcription

1 Integer Numbers The Number Bases of Integers Textbook Chapter 3

2 Number Systems Unary, or marks: /////// = 7 /////// + ////// = ///////////// Grouping lead to Roman Numerals: VII + V = VVII = XII Better: Arabic Numerals: = 12 = CMPE12 Summer

3 Positional Number System The value represented by a digit depends on its position in the number. Ex: 1832 CMPE12 Summer

4 Positional Number Systems Select a number as the base b Define an alphabet of b 1 symbols plus a symbol for zero to represent all numbers Use an ordered sequence of 2 or more digits d to represent numbers The represented number is the sum of all digits, each multiplied by b to the power of the digit s position p num digits Number = (d i b p ) i=0 CMPE12 Summer

5 Sexagesimal: A Positional Number System First used over 4000 years ago in Mesopotamia Base 60 (Sexagesimal), alphabet: 0..59, written as 60 different symbols But the Babylonians used only two symbols, 1 and 10, and didn t have the zero Needed context to tell 1 from 60! Example 5,45 60 = CMPE12 Summer

6 Babylonian Numbers CMPE12 Summer

7 Arabic/Indic Numerals Base 10 (decimal) The alphabet is 0..9 We use the Arabic symbols for the 10 digits Has the ZERO Numerals introduced to Europe by Leonardo Fibonacci in his Liber Abaci In in 1202 So useful! CMPE12 Summer

8 Arabic/Indic Numerals The Italian mathematician Leonardo Fibonacci Also known for the Fibonacci sequence 1, 1, 2, 3, 5, 8, 13, 21 CMPE12 Summer

9 Base Conversion Three cases: I. From any base b to base 10 II. III. From base 10 to any base b From any base b to any other base c CMPE12 Summer

10 From Base b to Base 10 n-1 Value = Σ (d i b i ) i=0 Positional number systems make it easy CMPE12 Summer

11 From Base b to Base 10 Example: =? 10 CMPE12 Summer

12 From Base 10 to Base b Use successive divisions Remember the remainders Divide again with the quotients CMPE12 Summer

13 From Base 10 to Base b Example: =? 5 CMPE12 Summer

14 From Base b to Base c Use a known intermediate base The easiest way is to convert from base b to base 10 first, and then from 10 to c Or, in some cases, it is easier to use base 2 as the intermediate base (we ll see them soon) CMPE12 Summer

15 Number of Digits How many digits are required to represent a number x in base b? CMPE12 Summer

16 Roman Multiplication XXXIII (33 in decimal) XII (12 in decimal) CMPE12 Summer

17 Positional Multiplication (a lot easier!) CMPE12 Summer

18 Numbers for Computers There are many ways to represent a number Representation does not affect computation result Representation affects difficulty of computing results Computers need a representation that works with (fast) electronic circuits Positional numbers work great with 2-state devices Which base should we use for computers? CMPE12 Summer

19 Binary Number System Base (radix): 2 Alphabet: 0, 1 Binary Digits, or bits Example: = = CMPE12 Summer

20 Octal Number System Base (radix): 8 Alphabet: 0, 1, 2, 3, 4, 5, 6, = = In C, octal numbers are represented with a leading 0. CMPE12 Summer

21 Hexadecimal Number System Base (radix): 16 Alphabet: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F In C: leading 0x (e.g., 0xa3) In LC-3: leading x (e.g., x3000 ) Hexadecimal is also known as hex for short Hex Decimal a 10 b 11 c 12 d 13 e 14 f 15 CMPE12 Summer

22 Examples of Converting Hex to Decimal A3 16 = 3E8 16 = CMPE12 Summer

23 Decimal To Binary Conversion: Method 1 Divide decimal value by 2 until the value is 0 Example: Divide 444 by 2; what is the remainder? Divide 222 by 2; what is the remainder? Result is 0: done Read backwards for binary representation CMPE12 Summer

24 Decimal To Binary Conversion: Method 2 Know your powers of two and subtract Example: What is the biggest power of two that fits? What is the remainder? What fits? What is the remainder? What is the binary representation? CMPE12 Summer

25 Knowing The Powers Of Two Know them in your sleep CMPE12 Summer

26 Binary to Octal Conversion Group into 3 starting at least significant bit Why 3? Add leading 0 as needed Why not trailing 0s? Write one octal digit for each group CMPE12 Summer

27 Binary to Octal Conversion: Examples (binary) (octal) (binary) (octal) CMPE12 Summer

28 Binary to Hex Conversion Group into 4 starting at least significant bit Why 4? Add leading 0 if needed Write one hex digit for each group CMPE12 Summer

29 Binary to Hex Conversion: Examples (binary) (hex) (binary) (hex) CMPE12 Summer

30 Octal to Binary Conversion Write down the 3-bit binary code for each octal digit Example: 047 Octal Binary CMPE12 Summer

31 Hex to Binary Conversion Write down the 4-bit binary code for each hex digit Example: 0x 3 9 c 8 Hex Bin Hex Bin a b c d e f 1111 CMPE12 Summer

32 Conversion Table Decimal Hexadecimal Octal Binary A B C D E F CMPE12 Summer

33 More Conversions Hex Octal Do it in 2 steps Hex binary octal Decimal Hex Do it in 2 steps Decimal binary hex So why use hex and octal and not just binary and decimal? CMPE12 Summer

34 Largest Number What is the largest number that we can represent in n digits In base 10? In base 2? In octal? In hex? In base 7? In base b? How many different numbers can we represent with n digits in base b? CMPE12 Summer

35 Binary Numbers

36 The Families of Binary Numbers Integers Unsigned Represented as unsigned binary Signed Sign-and-magnitude 1 s complement 2 s complement Biased notation Fractional Numbers IEEE Standard for Binary Floating Point Arithmetic CMPE12 Summer

37 Unsigned Binary It s a binary number that is always positive ( 0) Unsigned numbers have no sign So we assume they are positive (or zero) CMPE12 Summer

38 Unsigned Binary Addition Ripple carry Same principle as in decimal (or any base b) Add down the columns starting with least significant bit Carry over to the next column as needed CMPE12 Summer

39 Unsigned Binary Addition Example 1 simple addition Example 2 a problem occurs CMPE12 Summer

40 Unsigned Binary Addition: Overflow Not enough bits to represent the digit Depends on the number of bits allowed for the representation Overflow = roll-over CMPE12 Summer

41 Unsigned Binary Subtraction Ripple-borrow Same principle as in decimal (or any base b) Subtract down the columns starting with least significant bit Borrow from previous column as needed CMPE12 Summer

42 Unsigned Binary Subtraction Example CMPE12 Summer

43 Unsigned Binary Multiplication Multiply by one bit at a time (partial products) Add partial products for answer Same principle as in decimal (or any base b) Multiply n-bit numbers for a 2n-bit result CMPE12 Summer

44 Unsigned Binary Multiplication Example 1010 x 0011 CMPE12 Summer

45 Signed Numbers In Real Life Most humans precede negative number with E.g., 2000 Accountants, however, use parentheses E.g., (2000) or color 2000 Example: in hex? = e = 3e8 16 CMPE12 Summer

46 Signed Numbers In Binary Four main signed representations Sign-and-magnitude One s complement Two s complement Biased notation CMPE12 Summer

47 Sign-and-Magnitude The first bit carries information about the sign 0 is positive 1 is negative The rest of the number is the magnitude (it s bigness) CMPE12 Summer

48 Sign-and-Magnitude How does it work? Pros Intuitive Easy to invert the sign Cons Add and sub must compare sign and magnitude of the operands Two representations of zero x y CMPE12 Summer

49 Sign-and-Magnitude: Arithmetic Depends on sign of operands Same sign Add the magnitudes, keep the sign Different sign Subtract smaller from larger, keep sign of larger Overflow when CMPE12 Summer

50 Sign-and-Magnitude: Arithmetic Example 1 Perform A+B on 5 bits Where A = 2, B = 10 Example 2 Perform A+B on 5 bits Where A = 6, B = 10 CMPE12 Summer

51 Sign-and-Magnitude Mapping Number represented Number encoded Range on n bits: CMPE12 Summer

52 One s Complement It is called one s complement Converting to one s complement: For positive numbers Converting to one s complement: For negative numbers Flip the bits of the magnitude CMPE12 Summer

53 One s Complement How does it work? x 000 y Pros Still intuitive Easy to invert the sign Cons Add and subtract require a special operation (end-around carry) Two representations of zero CMPE12 Summer

54 One s Complement: Arithmetic Add or subtract normally Same sign or different sign Doesn t matter If there is a carry-out, add it back in Overflow when CMPE12 Summer

55 One s Complement: Arithmetic Example 1 A+B with A= 2, B=1 on 3 bits Example 2 A+B with A=3, B=3 on 3 bits CMPE12 Summer

56 One s Complement Mapping Number represented Number encoded Range on n bits: CMPE12 Summer

57 Two s Complement It is called two s complement Converting to two s complement: For positive numbers Converting to two s complement: For negative numbers Method 1 Flip the bits and add one Method 2 Keep all the leftmost zeros Keep first leftmost one Flip all other bits CMPE12 Summer

58 Two s Complement How does it work? Pros Add/sub are simple Easy to implement in hardware Subtraction only requires one adder Single zero Cons Asymmetric range Logical negation arithmetic negation x y CMPE12 Summer

59 Two s Complement: Arithmetic Addition As normal binary addition Carry-out is ignored Subtraction A B = A+( B) Take 2 s complement of B to get B Add B to A Overflow when CMPE12 Summer

60 Two s Complement: Arithmetic Example A+B, with A=2, B=1 on 3 bits Example A-B, with A=1, B=2 on 3 bits CMPE12 Summer

61 Two s Complement: Sign-Extension The most significant bit carries the sign MSb Example A B, with A=12, B=5 on 8 bits CMPE12 Summer

62 Two s Complement: Overflow Overflow happens when adding two operands of the same sign and the sign of the sum is different Depends on the number of bits Positive + positive = negative: OVERFLOW Negative + negative = positive: OVERFLOW Positive + negative = anything (no overflow) Why? Ex: 10+8 on 5 bits CMPE12 Summer

63 Two s Complement Mapping Number represented Number encoded Range on n bits: CMPE12 Summer

64 Biased Notation A way of remapping the numbers Add the bias to the number to get into the biased notation Subtract the bias from the number to get out of biased notation CMPE12 Summer

65 Biased Binary Notation How does it work? Pros Preserves lexical order Single zero Cons Add and sub require one additional operation to adjust the bias x y CMPE12 Summer

66 Biased Notation: Arithmetic Add or subtract normally Then subtract the bias to compensate C = A (+ bias) + B (+ bias) bias Overflow when CMPE12 Summer

67 Biased Notation: Arithmetic Example A+B, with A = 2, B = 1, on 3 bits (bias-3) Example A-B, with A = 1, B = 3, on 3 bits (bias-3) CMPE12 Summer

68 Biased Notation Mapping Number represented Number encoded Range on n bits: CMPE12 Summer

69 Summary of Binary Representations Binary Representation Range Quirk Negative numbers Overflow Unsigned 0 to 2 n 1 No negatives None Carry-out from MSb Sign-and-Magnitude 2 n-1 1 to 2 n-1 1 Has two zeros One s complement 2 n-1 1 to 2 n-1 1 Has two zeros First bit is sign; rest is unsigned Flip bits of magnitude Carry-out into MSb Sign discrepancy Two s complement 2 n-1 to 2 n-1 1 Range is asymmetric (more negative numbers) Biased 2 n-1 to 2 n-1 1 Add bias to get into it Add one to one s complement Sign discrepancy??? Exceeds largest CMPE12 Summer

70 Integer data types Byte: ordered set of 8 bits Nybble: ordered set of 4 bits Word: ordered set of CMPE12 Summer

71 7-bit ASCII table CMPE12 Summer

72 Recommended Exercises Ex 2.1 to 2.27 (especially important are 2.12, 2.15, 2.20, and 2.25) Ex 2.35, 2.36, 2.37, 2.38 Ex 2.45 to 2.50 Ex 2.53 and 2.54 CMPE12 Summer

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

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

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

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

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

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

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

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

Decimal Numbers: Base 10 Integer Numbers & Arithmetic

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

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

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

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

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

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,

More information

Signed Binary Arithmetic

Signed Binary Arithmetic Signed Binary Arithmetic In the real world of mathematics, computers must represent both positive and negative binary numbers. For example, even when dealing with positive arguments, mathematical operations

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

198:211 Computer Architecture

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

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

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

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

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

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

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

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 8: Binary Multiplication & Division

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

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

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

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

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

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals: Numeral Systems Which number is larger? 25 8 We need to distinguish between numbers and the symbols that represent them, called numerals. The number 25 is larger than 8, but the numeral 8 above is larger

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

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

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

2 Number Systems 2.1. Foundations of Computer Science Cengage Learning

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

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

4 Operations On Data

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

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

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

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

= 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

More information

Binary Numbers The Computer Number System

Binary Numbers The Computer Number System Binary Numbers The Computer Number System Number systems are simply ways to count things. Ours is the base-0 or radix-0 system. Note that there is no symbol for 0 or for the base of any system. We count,2,3,4,5,6,7,8,9,

More information

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

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

Simulation & Synthesis Using VHDL

Simulation & Synthesis Using VHDL Floating Point Multipliers: Simulation & Synthesis Using VHDL By: Raj Kumar Singh - B.E. (Hons.) Electrical & Electronics Shivananda Reddy - B.E. (Hons.) Electrical & Electronics BITS, PILANI Outline Introduction

More information

Chapter 1: Digital Systems and Binary Numbers

Chapter 1: Digital Systems and Binary Numbers Chapter 1: Digital Systems and Binary Numbers Digital age and information age Digital computers general purposes many scientific, industrial and commercial applications Digital systems telephone switching

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

Lecture 2: Number Representation

Lecture 2: Number Representation Lecture 2: Number Representation CSE 30: Computer Organization and Systems Programming Summer Session II 2011 Dr. Ali Irturk Dept. of Computer Science and Engineering University of California, San Diego

More information

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

More information

Binary Numbering Systems

Binary Numbering Systems Binary Numbering Systems April 1997, ver. 1 Application Note 83 Introduction Binary numbering systems are used in virtually all digital systems, including digital signal processing (DSP), networking, and

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

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

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

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

Number Systems I. CIS008-2 Logic and Foundations of Mathematics. David Goodwin. 11:00, Tuesday 18 th October

Number Systems I. CIS008-2 Logic and Foundations of Mathematics. David Goodwin. 11:00, Tuesday 18 th October Number Systems I CIS008-2 Logic and Foundations of Mathematics David Goodwin david.goodwin@perisic.com 11:00, Tuesday 18 th October 2011 Outline 1 Number systems Numbers Natural numbers Integers Rational

More information

Chapter 6 Digital Arithmetic: Operations & Circuits

Chapter 6 Digital Arithmetic: Operations & Circuits Chapter 6 Digital Arithmetic: Operations & Circuits Chapter 6 Objectives Selected areas covered in this chapter: Binary addition, subtraction, multiplication, division. Differences between binary addition

More information

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal 2/9/9 Binary number system Computer (electronic) systems prefer binary numbers Binary number: represent a number in base-2 Binary numbers 2 3 + 7 + 5 Some terminology Bit: a binary digit ( or ) Hexadecimal

More information

Binary. ! You are probably familiar with decimal

Binary. ! You are probably familiar with decimal Arithmetic operations in assembly language Prof. Gustavo Alonso Computer Science Department ETH Zürich alonso@inf.ethz.ch http://www.inf.ethz.ch/department/is/iks/ Binary! You are probably familiar with

More information

Fixed-Point Arithmetic

Fixed-Point Arithmetic Fixed-Point Arithmetic Fixed-Point Notation A K-bit fixed-point number can be interpreted as either: an integer (i.e., 20645) a fractional number (i.e., 0.75) 2 1 Integer Fixed-Point Representation N-bit

More information

Number Systems, Base Conversions, and Computer Data Representation

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

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

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

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

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

CS 16: Assembly Language Programming for the IBM PC and Compatibles

CS 16: Assembly Language Programming for the IBM PC and Compatibles CS 16: Assembly Language Programming for the IBM PC and Compatibles First, a little about you Your name Have you ever worked with/used/played with assembly language? If so, talk about it Why are you taking

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

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

CHAPTER 3 Numbers and Numeral Systems

CHAPTER 3 Numbers and Numeral Systems CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,

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

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

HOMEWORK # 2 SOLUTIO

HOMEWORK # 2 SOLUTIO HOMEWORK # 2 SOLUTIO Problem 1 (2 points) a. There are 313 characters in the Tamil language. If every character is to be encoded into a unique bit pattern, what is the minimum number of bits required to

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

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

Activity 1: Bits and Bytes

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

More information

The University of Nottingham

The University of Nottingham The University of Nottingham School of Computer Science A Level 1 Module, Autumn Semester 2007-2008 Computer Systems Architecture (G51CSA) Time Allowed: TWO Hours Candidates must NOT start writing their

More information

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

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

More information

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

Fractional Numbers. Fractional Number Notations. Fixed-point Notation. Fixed-point Notation

Fractional Numbers. Fractional Number Notations. Fixed-point Notation. Fixed-point Notation 2 Fractional Numbers Fractional Number Notations 2010 - Claudio Fornaro Ver. 1.4 Fractional numbers have the form: xxxxxxxxx.yyyyyyyyy where the x es constitute the integer part of the value and the y

More information

Borland C++ Compiler: Operators

Borland C++ Compiler: Operators Introduction Borland C++ Compiler: Operators An operator is a symbol that specifies which operation to perform in a statement or expression. An operand is one of the inputs of an operator. For example,

More information

Chapter 4. Arithmetic for Computers

Chapter 4. Arithmetic for Computers Chapter 4 Arithmetic for Computers Arithmetic Where we've been: Performance (seconds, cycles, instructions) What's up ahead: Implementing the Architecture operation a b 32 32 ALU 32 result 2 Constructing

More information

Chapter Binary, Octal, Decimal, and Hexadecimal Calculations

Chapter Binary, Octal, Decimal, and Hexadecimal Calculations Chapter 5 Binary, Octal, Decimal, and Hexadecimal Calculations This calculator is capable of performing the following operations involving different number systems. Number system conversion Arithmetic

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

Paramedic Program Pre-Admission Mathematics Test Study Guide

Paramedic Program Pre-Admission Mathematics Test Study Guide Paramedic Program Pre-Admission Mathematics Test Study Guide 05/13 1 Table of Contents Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 Page 9 Page 10 Page 11 Page 12 Page 13 Page 14 Page 15 Page

More information

Lab 4 Large Number Arithmetic. ECE 375 Oregon State University Page 29

Lab 4 Large Number Arithmetic. ECE 375 Oregon State University Page 29 Lab 4 Large Number Arithmetic ECE 375 Oregon State University Page 29 Objectives Understand and use arithmetic and ALU operations Manipulate and handle large numbers Create and handle functions and subroutines

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

Data Storage 3.1. Foundations of Computer Science Cengage Learning

Data Storage 3.1. Foundations of Computer Science Cengage Learning 3 Data Storage 3.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List five different data types used in a computer. Describe how

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

LABORATORY. Exploring Number Systems OBJECTIVES REFERENCES

LABORATORY. Exploring Number Systems OBJECTIVES REFERENCES Dmitriy Shironosov/ShutterStock, Inc. LABORATORY Exploring Number Systems 2 OBJECTIVES Experiment with number systems. Gain practice adding in binary and converting between bases. REFERENCES Software needed:

More information

The Essentials of Computer Organization and Architecture. Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003

The Essentials of Computer Organization and Architecture. Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 The Essentials of Computer Organization and Architecture Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 Chapter 2 Instructor's Manual Chapter Objectives Chapter 2, Data Representation,

More information

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

Binary math. Resources and methods for learning about these subjects (list a few here, in preparation for your research): Binary math 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 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

Sistemas Digitais I LESI - 2º ano

Sistemas Digitais I LESI - 2º ano Sistemas Digitais I LESI - 2º ano Lesson 6 - Combinational Design Practices Prof. João Miguel Fernandes (miguel@di.uminho.pt) Dept. Informática UNIVERSIDADE DO MINHO ESCOLA DE ENGENHARIA - PLDs (1) - The

More information

Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points.

Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points. 2 MODULE 4. DECIMALS 4a Decimal Arithmetic Adding Decimals Recall the process used for adding decimal numbers. Adding Decimals. To add decimal numbers, proceed as follows: 1. Place the numbers to be added

More information

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

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

More information

BINARY CODED DECIMAL: B.C.D.

BINARY CODED DECIMAL: B.C.D. BINARY CODED DECIMAL: B.C.D. ANOTHER METHOD TO REPRESENT DECIMAL NUMBERS USEFUL BECAUSE MANY DIGITAL DEVICES PROCESS + DISPLAY NUMBERS IN TENS IN BCD EACH NUMBER IS DEFINED BY A BINARY CODE OF 4 BITS.

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

MACHINE INSTRUCTIONS AND PROGRAMS

MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER OBJECTIVES In this chapter you will learn about: Machine instructions and program execution, including branching and subroutine call and return operations

More information

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to: Chapter 3 Data Storage Objectives After studying this chapter, students should be able to: List five different data types used in a computer. Describe how integers are stored in a computer. Describe how

More information

Integer multiplication

Integer multiplication Integer multiplication Suppose we have two unsigned integers, A and B, and we wish to compute their product. Let A be the multiplicand and B the multiplier: A n 1... A 1 A 0 multiplicand B n 1... B 1 B

More information

This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30)); Introduction to Embedded Microcomputer Systems Lecture 5.1 2.9. Conversions ASCII to binary n = 100*(Data[0]-0x30) + 10*(Data[1]-0x30) + (Data[2]-0x30); This 3-digit ASCII string could also be calculated

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

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

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc

More information

CHAPTER TWO. 2.1 Unsigned Binary Counting. Numbering Systems

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,

More information

Discrete Structures. Rajmohan Rajaraman Eric Ropiak Chris Burrows Ravi Sundaram

Discrete Structures. Rajmohan Rajaraman Eric Ropiak Chris Burrows Ravi Sundaram Discrete Structures Harriet Fell Javed A. Aslam Rajmohan Rajaraman Eric Ropiak Chris Burrows Ravi Sundaram Discrete Structures Version 2.1 Harriet Fell Javed A. Aslam Rajmohan Rajaraman Eric Ropiak Chris

More information