CS321. Introduction to Numerical Methods

Size: px
Start display at page:

Download "CS321. Introduction to Numerical Methods"

Transcription

1 CS31 Introduction to Numerical Methods Lecture 1 Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY August 5, 017

2 Number in Different Bases Humans use number base 10 for reasons of the number of fingers Computers use number base for reasons of on off switch A number based on 8 can be used to facilitate conversion between the base and the base 10 Base 10 Expansion: The general formula for a base 10 integer is a n a n 1 a a 1 a 0 a a a 10 a n 1 10 n 1 a n 10 n

3 Binary Numbers 3

4 Number System 4

5 Definitions There are some definitions for representing a real number in base 10 and in base 5

6 Nonintegers and Fractions An example of a fractional number The general formula for a decimal fraction b1bb3 b1 10 b 10 b3 10 Decimal fractional numbers can be repeating or nonrepeating (rational or irrational numbers) ( a a a a. b b b ) n n1 1 0 n k ak 10 k0 k1 1 b k 3 10 k 10 6

7 Number Conversion 7

8 Base β Numbers Convert an integer number from base 8 system to base 10 system (763 General formula ) (3 8(6 8 3 ( ( ) (6 (8(7))) 8(7 ))) 7 8 (3994 ) 10 Convert a fractional number between 0 and 1 1 (0.763 ) ( a n a n k ak k0 k1 n1 a1a0. b1b b3 ) b k k 3 3 Convert integer and fractional parts separately 8

9 From system α to system β with α < β Conversion between Systems express (N) α in nested form using powers of α replace each digit by corresponding base β number carry out indicated arithmetic in base β Two examples were given in the previous page Note that one needs to convert the integer and the fractional parts separately The method is in theory can be used to convert a number between any two bases. But the third step is not easy for humans if the base is not 10 9

10 Division Algorithm Use remainder quotient split method to convert an integer, best if α > β 1. Divide the representation by β;. Take the remainder as the next digit in the base β representation; 3. Repeat the procedure on the quotient. This procedure is easier to carry out by hand Note that the first digit obtained is the one closest to the radix point )) ) ( ( ( ) ( ) ( m m m c c c c c c c c N 10

11 Repeated Division To convert a base 10 integer number to a base β<10 number, we can use repeated division algorithm / 8 5 / 8 So we have / It can be further converted to a binary number using the binary octal table (in a later slide) ( 576.) / 8 ( 576.) remainder remainder remainder remainder ( ) 8 Note that the first digit you obtain is the first digit next to the radix point (500.) 8 ( )

12 Multiplication Algorithm Use integer fraction split process for converting a fractional part x k 1 c k - k (0. c 1 cc3 ) 1.) multiply the (fractional) number by β;.) take the integer part as the first (next) digit; 3.) repeat the process on the remaining fractional part. Again, the first digit obtained is the one closest to the radix point Terminating fractional number may become non terminating in different base systems, and vice versa 1

13 Integer Fraction Split To convert a fractional base 10 number to a base β<10 number, we can use the integer fractional split algorithm So we have ( 0.37 ) 10 ( ) 13

14 Use Intermediate Base We can convert a base 10 number to a base 8 (octal) number, then to base (binary) number, and vice versa Binary octal table Groups of three binary digits can be translated to an octal number using the binary octal table ( ) = ( ) 8 = (?) 10 (57.31) 10 = (?) 8 = (?) 14

15 Base 16 Numbers Certain computers with word length being multiples of 4 use hexadecimal system, need A, B, C, D, E, and F to represent 10, 11, 1, 13, 14, and 15. Binary hexadecimal table ( ) = ( ) = (BC.DF)16 15

16 Definitions There are some definitions for representing a real number in base 10 and in base 16

17 Write a number in the form of Normalized Scientific Notation A normalized floating point number has the form 4 10 where d 1 0,n is an integer x. d d d n In a simple notation 1 n x r 10 r 1 10 r is called normalized mantissa and n is the exponent. Also for binary representation x q m 1 q 1 17

18 Machine Numbers The real numbers that can be represented exactly in a computer are called the machine numbers for this computer Most real numbers are not machine numbers If a computer has word length of the form 0.d 1 d d 3 d 4, then is a machine number, but is not Machine numbers are machine dependent. The use of normalized floating point numbers creates a phenomenon of hole at zero, a bunch of numbers close to 0 are not representable This is mainly caused by the under flow problem, i.e., small numbers close to zero will be treated as zero in a computer. ( cannot be stored in the above mentioned computer, why?) 18

19 A 3 bit Machine Single precision floating point numbers with 3 bit word length How to store a floating point number with 3 bits? Sign of q needs 1 bit Integer m needs 8 bits Number q needs 3 bits m q Single precision IEEE standard floating point format s c17 ( 1) (1. f ) 0<c<55 19

20 3 bit Representation The exponent number c is actually stored, so m = c 17, this is an excess 17 code (make sure only positive numbers are stored, 0< c <55) With normalized representation, the first bit is always 1 and needs not be stored. The mantissa actually contains 4 binary digits with a hidden bit With a mantissa of 3 bits, a machine can have about six significant decimal 3 7 digits of accuracy, since 1.10 The smallest positive number є such that +ε is called the machine epsilon or unit roundoff error 3 Academic definition 1.0 non academic definition For single precision, For double precision,

21 3 bit Representation IEEE 3 bit single precision 1

22 64 bit Representation IEEE 3 bit single precision and 64 bit double precision For each integer, single precision allocates 31 bit, double precision allocates 61 bits

23 The exponent c is stored, with More About the Exponent 0 < < 55 = ( ) The actual range of exponent is =0 is reserved for the special number ±0, and =55is for ± This strategy avoids the need to handle sign for the exponent The largest number can be stored The smallest number can be stored

24 Patriot Missile Defense System 4

25 How to represent a real number x? Representation Procedure 1.) if x is zero, stored it by a full word of zero bits, (a possible sign bit).) for nonzero x, first consider sign bit and then consider x 3.) convert both integer and fractional parts of x from decimal to octal, then to binary 4.) one plus normalize ( x ) by shifting the binary point 5.) find the 4 bit 1 plus normalized mantissa 6.) find the exponent of by setting it equal to c-17 and determine c 7.) denote the 3 bit representation as 8 hexadecimal digits 5

26 A 3 bit single precision pattern Summary and Examples can be interpreted as the real number Examples b 1bb3 b9b10b11 b3 Find the 3 bit representation of Integer part (5.) 10 = (64.) 8 = ( ) Fractional part (.34375) 10 = (.17) 8 = ( ) b ( b b b ) ( 1) 1 (1. b b b ) 6

27 Examples cont ( ) ( ) 5 The exponent is (5) 10, we need to write it as c - 17 = 5 so c = 13 The stored exponent is ( 13) The representation of is ( ) = ( ) =(C50F000) 16 What number has the representation (45DE4000) 16? 10 (04) 8 ( ) 7

28 Errors in Representing Numbers Non machine numbers are represented by a nearest machine number in computer Additional digits will be truncated Correct rounding and roundoff error For a 3 bit single precision machine with 3 bits for mantissa, the relative error in correct rounding is 3 The unit roundoff error is 1 4 For a computer with a 4 binary digit word length, the number will be stored as for rounding off, and for correct rounding 8

29 Arithmetic Operations Most computers use double length arithmetic operations. Numbers are extended to double length, arithmetic operations are performed, and the result is rounded to a single length number On a machine with 4 digit word length, this number needs to be rounded to resulting in an error

30 Notation fl(x) Use fl(x) to denote the floating point machine number corresponding to a real number x fl(x) = x( 1 + δ), For the 3 bit machine (with correct rounding), we have It is easy to see that if є < -3, then fl(1 + є) = 1 Note that the numbers are smaller than ε. It has more than 3 zeros. 30

31 Inverse Error Analysis More generally known as backward error analysis Denote as one of the basic arithmetic operations, then fl(x y) = (x y)(1 + δ), Two interpretations fl(z) = (x + y)(1 + δ) perturbation of sum fl(z) = x(1 + δ) + y(1 + δ) sum of perturbations Direct error analysis and reverse error analysis Forward error analysis and backward error analysis 4 31

32 Loss of Significance Subtraction of two nearly equal numbers may result in loss of significant digits on a finite precision machine Cure: reprogram or use higher precision arithmetic, may be costly Use a 4 word length computer: = = = = Loss of Precision Theorem Let x and y be normalized floating point machine numbers with x > y > 0. If p q 1 y/ x for some positive integers p and q, then at most p and at least q significant digits are lost in the subtraction x - y 3

33 Loss of Significance Since y<x, the computer has to shift y before carrying out the subtraction so Look at the mantissa Hence, to normalize the representation of x y, a shift of at least q bits to the left is necessary. Thus at least q (spurious) zeros are supplied on the right hand side of the mantissa ) ) (1 ) (1 p q n m n m r x y r r s r s r ( n n m s y ) ( 1, 1 where,, s r s y r x m n n n m s r y x ) ( 33

34 x = and y = y , x An Example from Book which is between -1 = and -11 = At least 11 and at most 1 binary digits are lost when computing x - y Exactly how many digits lost depends on a computer x = and y = Suppose a machine has 5 decimal digits of accuracy We have ~ x and ~ y , The machine computes ~ ~ 3 x y

35 An Example Cont. Exact computation The relative error is x y = = ~ ~ x y x y x y This relative error is considered to be large since the machine has 5 decimal digits of accuracy Note that the double length computing operations are carried out after the numbers are stored If we use a machine with at least 8 decimal digits of accuracy, we can have the exact value as

36 Avoiding Loss of Significance Analyze possible loss of significance, reschedule computation to avoid subtraction of two nearly equal numbers, modify algorithm Example. Evaluating f ( x) 1 1 Using 5 decimal digit arithmetic for x = 10-3, we have f(x) = 0 Rationalizing the numerator, we have x f ( x) x x 1 1 at x 0 computing ( ) , and f ( x)

37 More Examples Evaluating f ( x) x sin x at x 0 (. ) Using Taylor series for sin x sin x x 3 x 3! 5 x 5! 7 x 7! Then f ( x) Compute x = 0.1 with four decimal digit arithmetic, sin(0.1) = So x -sin x = But x 3 /3! = This strategy is not good for large x. For x = π, x sin π = π, but x 3 /3! = Range reduction for periodic functions sin 3 x 3! 5 x 5! 7 x 7! sin sin

CS321 Introduction To Numerical Methods

CS321 Introduction To Numerical Methods CS3 Introduction To Numerical Methods Fuhua (Frank) Cheng Department of Computer Science University of Kentucky Lexington KY 456-46 - - Table of Contents Errors and Number Representations 3 Error Types

More information

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

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers

More information

Review of Calculus, cont d

Review of Calculus, cont d Jim Lambers MAT 460/560 Fall Semester 2009-10 Lecture 4 Notes These notes correspond to Sections 1.1 1.2 in the text. Review of Calculus, cont d Taylor s Theorem, cont d We conclude our discussion of Taylor

More information

Roundoff Errors and Computer Arithmetic

Roundoff Errors and Computer Arithmetic Jim Lambers Math 105A Summer Session I 2003-04 Lecture 2 Notes These notes correspond to Section 1.2 in the text. Roundoff Errors and Computer Arithmetic In computing the solution to any mathematical problem,

More information

Mathematical preliminaries and error analysis

Mathematical preliminaries and error analysis Mathematical preliminaries and error analysis Tsung-Ming Huang Department of Mathematics National Taiwan Normal University, Taiwan August 28, 2011 Outline 1 Round-off errors and computer arithmetic IEEE

More information

Divide: Paper & Pencil

Divide: Paper & Pencil Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or

More information

Floating Point Arithmetic

Floating Point Arithmetic Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? Unsigned 0 to 2 N 2s Complement -2 N-1 to 2 N-1-1 But, what about? very large numbers? 9,349,398,989,787,762,244,859,087,678

More information

Section 1.4 Mathematics on the Computer: Floating Point Arithmetic

Section 1.4 Mathematics on the Computer: Floating Point Arithmetic Section 1.4 Mathematics on the Computer: Floating Point Arithmetic Key terms Floating point arithmetic IEE Standard Mantissa Exponent Roundoff error Pitfalls of floating point arithmetic Structuring computations

More information

Scientific Computing. Error Analysis

Scientific Computing. Error Analysis ECE257 Numerical Methods and Scientific Computing Error Analysis Today s s class: Introduction to error analysis Approximations Round-Off Errors Introduction Error is the difference between the exact solution

More information

in this web service Cambridge University Press

in this web service Cambridge University Press 978-0-51-85748- - Switching and Finite Automata Theory, Third Edition Part 1 Preliminaries 978-0-51-85748- - Switching and Finite Automata Theory, Third Edition CHAPTER 1 Number systems and codes This

More information

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3 Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Instructor: Nicole Hynes nicole.hynes@rutgers.edu 1 Fixed Point Numbers Fixed point number: integer part

More information

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

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems

More information

MACHINE LEVEL REPRESENTATION OF DATA

MACHINE LEVEL REPRESENTATION OF DATA MACHINE LEVEL REPRESENTATION OF DATA CHAPTER 2 1 Objectives Understand how integers and fractional numbers are represented in binary Explore the relationship between decimal number system and number systems

More information

Classes of Real Numbers 1/2. The Real Line

Classes of Real Numbers 1/2. The Real Line Classes of Real Numbers All real numbers can be represented by a line: 1/2 π 1 0 1 2 3 4 real numbers The Real Line { integers rational numbers non-integral fractions irrational numbers Rational numbers

More information

2 Computation with Floating-Point Numbers

2 Computation with Floating-Point Numbers 2 Computation with Floating-Point Numbers 2.1 Floating-Point Representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However, real numbers

More information

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right. Floating-point Arithmetic Reading: pp. 312-328 Floating-Point Representation Non-scientific floating point numbers: A non-integer can be represented as: 2 4 2 3 2 2 2 1 2 0.2-1 2-2 2-3 2-4 where you sum

More information

Number Systems CHAPTER Positional Number Systems

Number Systems CHAPTER Positional Number Systems CHAPTER 2 Number Systems Inside computers, information is encoded as patterns of bits because it is easy to construct electronic circuits that exhibit the two alternative states, 0 and 1. The meaning of

More information

Lecture Objectives. Structured Programming & an Introduction to Error. Review the basic good habits of programming

Lecture Objectives. Structured Programming & an Introduction to Error. Review the basic good habits of programming Structured Programming & an Introduction to Error Lecture Objectives Review the basic good habits of programming To understand basic concepts of error and error estimation as it applies to Numerical Methods

More information

2 Computation with Floating-Point Numbers

2 Computation with Floating-Point Numbers 2 Computation with Floating-Point Numbers 2.1 Floating-Point Representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However, real numbers

More information

Floating-Point Numbers in Digital Computers

Floating-Point Numbers in Digital Computers POLYTECHNIC UNIVERSITY Department of Computer and Information Science Floating-Point Numbers in Digital Computers K. Ming Leung Abstract: We explain how floating-point numbers are represented and stored

More information

Floating-Point Numbers in Digital Computers

Floating-Point Numbers in Digital Computers POLYTECHNIC UNIVERSITY Department of Computer and Information Science Floating-Point Numbers in Digital Computers K. Ming Leung Abstract: We explain how floating-point numbers are represented and stored

More information

Number Systems. Both numbers are positive

Number Systems. Both numbers are positive Number Systems Range of Numbers and Overflow When arithmetic operation such as Addition, Subtraction, Multiplication and Division are performed on numbers the results generated may exceed the range of

More information

fractional quantities are typically represented in computers using floating point format this approach is very much similar to scientific notation

fractional quantities are typically represented in computers using floating point format this approach is very much similar to scientific notation Floating Point Arithmetic fractional quantities are typically represented in computers using floating point format this approach is very much similar to scientific notation for example, fixed point number

More information

Computational Methods. Sources of Errors

Computational Methods. Sources of Errors Computational Methods Sources of Errors Manfred Huber 2011 1 Numerical Analysis / Scientific Computing Many problems in Science and Engineering can not be solved analytically on a computer Numeric solutions

More information

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer Arithmetic ECE 666 Part 4-A Floating-Point Arithmetic Israel Koren ECE666/Koren Part.4a.1 Preliminaries - Representation

More information

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

COE 202- Digital Logic. Number Systems II. Dr. Abdulaziz Y. Barnawi COE Department KFUPM. January 23, Abdulaziz Barnawi. COE 202 Logic Design 1 COE 0- Digital Logic Number Systems II Dr. Abdulaziz Y. Barnawi COE Department KFUPM COE 0 Logic Design January 3, 016 Objectives Base Conversion Decimal to other bases Binary to Octal and Hexadecimal

More information

Hani Mehrpouyan, California State University, Bakersfield. Signals and Systems

Hani Mehrpouyan, California State University, Bakersfield. Signals and Systems Hani Mehrpouyan, Department of Electrical and Computer Engineering, California State University, Bakersfield Lecture 3 (Error and Computer Arithmetic) April 8 th, 2013 The material in these lectures is

More information

1.2 Round-off Errors and Computer Arithmetic

1.2 Round-off Errors and Computer Arithmetic 1.2 Round-off Errors and Computer Arithmetic 1 In a computer model, a memory storage unit word is used to store a number. A word has only a finite number of bits. These facts imply: 1. Only a small set

More information

Finite arithmetic and error analysis

Finite arithmetic and error analysis Finite arithmetic and error analysis Escuela de Ingeniería Informática de Oviedo (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 1 / 45 Outline 1 Number representation:

More information

Floating-point representation

Floating-point representation Lecture 3-4: Floating-point representation and arithmetic Floating-point representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However,

More information

Operations On Data CHAPTER 4. (Solutions to Odd-Numbered Problems) Review Questions

Operations On Data CHAPTER 4. (Solutions to Odd-Numbered Problems) Review Questions CHAPTER 4 Operations On Data (Solutions to Odd-Numbered Problems) Review Questions 1. Arithmetic operations interpret bit patterns as numbers. Logical operations interpret each bit as a logical values

More information

COMP Overview of Tutorial #2

COMP Overview of Tutorial #2 COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,

More information

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

COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem   ahmadsm AT kfupm Phone: Office: COE 0: Digital Logic Design Number Systems Part Dr. Ahmad Almulhem Email: ahmadsm AT kfupm Phone: 860-7554 Office: -34 Objectives Arithmetic operations: Binary number system Other number systems Base Conversion

More information

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

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1 IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose

More information

Errors in Computation

Errors in Computation Theory of Errors Content Errors in computation Absolute Error Relative Error Roundoff Errors Truncation Errors Floating Point Numbers Normalized Floating Point Numbers Roundoff Error in Floating Point

More information

Computational Mathematics: Models, Methods and Analysis. Zhilin Li

Computational Mathematics: Models, Methods and Analysis. Zhilin Li Computational Mathematics: Models, Methods and Analysis Zhilin Li Chapter 1 Introduction Why is this course important (motivations)? What is the role of this class in the problem solving process using

More information

ECE232: Hardware Organization and Design

ECE232: Hardware Organization and Design ECE232: Hardware Organization and Design Lecture 11: Floating Point & Floating Point Addition Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Last time: Single Precision Format

More information

Internal Data Representation

Internal Data Representation Appendices This part consists of seven appendices, which provide a wealth of reference material. Appendix A primarily discusses the number systems and their internal representation. Appendix B gives information

More information

Introduction to Computers and Programming. Numeric Values

Introduction to Computers and Programming. Numeric Values Introduction to Computers and Programming Prof. I. K. Lundqvist Lecture 5 Reading: B pp. 47-71 Sept 1 003 Numeric Values Storing the value of 5 10 using ASCII: 00110010 00110101 Binary notation: 00000000

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

Computational Economics and Finance

Computational Economics and Finance Computational Economics and Finance Part I: Elementary Concepts of Numerical Analysis Spring 2015 Outline Computer arithmetic Error analysis: Sources of error Error propagation Controlling the error Rates

More information

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction 1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in

More information

Floating Point Representation. CS Summer 2008 Jonathan Kaldor

Floating Point Representation. CS Summer 2008 Jonathan Kaldor Floating Point Representation CS3220 - Summer 2008 Jonathan Kaldor Floating Point Numbers Infinite supply of real numbers Requires infinite space to represent certain numbers We need to be able to represent

More information

Chapter 3. Errors and numerical stability

Chapter 3. Errors and numerical stability Chapter 3 Errors and numerical stability 1 Representation of numbers Binary system : micro-transistor in state off 0 on 1 Smallest amount of stored data bit Object in memory chain of 1 and 0 10011000110101001111010010100010

More information

Scientific Computing: An Introductory Survey

Scientific Computing: An Introductory Survey Scientific Computing: An Introductory Survey Chapter 1 Scientific Computing Prof. Michael T. Heath Department of Computer Science University of Illinois at Urbana-Champaign Copyright c 2002. Reproduction

More information

Chapter 2. Data Representation in Computer Systems

Chapter 2. Data Representation in Computer Systems Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting

More information

CHAPTER 2 SENSITIVITY OF LINEAR SYSTEMS; EFFECTS OF ROUNDOFF ERRORS

CHAPTER 2 SENSITIVITY OF LINEAR SYSTEMS; EFFECTS OF ROUNDOFF ERRORS CHAPTER SENSITIVITY OF LINEAR SYSTEMS; EFFECTS OF ROUNDOFF ERRORS The two main concepts involved here are the condition (of a problem) and the stability (of an algorithm). Both of these concepts deal with

More information

CHAPTER 5: Representing Numerical Data

CHAPTER 5: Representing Numerical Data CHAPTER 5: Representing Numerical Data The Architecture of Computer Hardware and Systems Software & Networking: An Information Technology Approach 4th Edition, Irv Englander John Wiley and Sons 2010 PowerPoint

More information

1.3 Floating Point Form

1.3 Floating Point Form Section 1.3 Floating Point Form 29 1.3 Floating Point Form Floating point numbers are used by computers to approximate real numbers. On the surface, the question is a simple one. There are an infinite

More information

Exponential Numbers ID1050 Quantitative & Qualitative Reasoning

Exponential Numbers ID1050 Quantitative & Qualitative Reasoning Exponential Numbers ID1050 Quantitative & Qualitative Reasoning In what ways can you have $2000? Just like fractions, you can have a number in some denomination Number Denomination Mantissa Power of 10

More information

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

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal Positional notation Ch.. /continued Conversions between Decimal and Binary Binary to Decimal - use the definition of a number in a positional number system with base - evaluate the definition formula using

More information

CS101 Lecture 04: Binary Arithmetic

CS101 Lecture 04: Binary Arithmetic CS101 Lecture 04: Binary Arithmetic Binary Number Addition Two s complement encoding Briefly: real number representation Aaron Stevens (azs@bu.edu) 25 January 2013 What You ll Learn Today Counting in binary

More information

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras Numbers and Computers Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras 1 Think of a number between 1 and 15 8 9 10 11 12 13 14 15 4 5 6 7 12 13 14 15 2 3 6 7 10 11 14 15

More information

Computational Economics and Finance

Computational Economics and Finance Computational Economics and Finance Part I: Elementary Concepts of Numerical Analysis Spring 2016 Outline Computer arithmetic Error analysis: Sources of error Error propagation Controlling the error Rates

More information

Chapter 3: Arithmetic for Computers

Chapter 3: Arithmetic for Computers Chapter 3: Arithmetic for Computers Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point Computer Architecture CS 35101-002 2 The Binary Numbering

More information

Computer Arithmetic Floating Point

Computer Arithmetic Floating Point Computer Arithmetic Floating Point Chapter 3.6 EEC7 FQ 25 About Floating Point Arithmetic Arithmetic basic operations on floating point numbers are: Add, Subtract, Multiply, Divide Transcendental operations

More information

Chapter 4 Section 2 Operations on Decimals

Chapter 4 Section 2 Operations on Decimals Chapter 4 Section 2 Operations on Decimals Addition and subtraction of decimals To add decimals, write the numbers so that the decimal points are on a vertical line. Add as you would with whole numbers.

More information

CHAPTER 2 Number Systems

CHAPTER 2 Number Systems CHAPTER 2 Number Systems Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish between non-positional and positional number systems.

More information

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

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

Module 2: Computer Arithmetic

Module 2: Computer Arithmetic Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

More information

Number Systems and Computer Arithmetic

Number Systems and Computer Arithmetic Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text

More information

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-1 CHAPTER V CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-2 NUMBER SYSTEMS RADIX-R REPRESENTATION Decimal number expansion 73625 10 = ( 7 10 4 ) + ( 3 10 3 ) + ( 6 10 2 ) + ( 2 10 1 ) +(

More information

Objectives. look at floating point representation in its basic form expose errors of a different form: rounding error highlight IEEE-754 standard

Objectives. look at floating point representation in its basic form expose errors of a different form: rounding error highlight IEEE-754 standard Floating Point Objectives look at floating point representation in its basic form expose errors of a different form: rounding error highlight IEEE-754 standard 1 Why this is important: Errors come in two

More information

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,

More information

Review Questions 26 CHAPTER 1. SCIENTIFIC COMPUTING

Review Questions 26 CHAPTER 1. SCIENTIFIC COMPUTING 26 CHAPTER 1. SCIENTIFIC COMPUTING amples. The IEEE floating-point standard can be found in [131]. A useful tutorial on floating-point arithmetic and the IEEE standard is [97]. Although it is no substitute

More information

3.1 DATA REPRESENTATION (PART C)

3.1 DATA REPRESENTATION (PART C) 3.1 DATA REPRESENTATION (PART C) 3.1.3 REAL NUMBERS AND NORMALISED FLOATING-POINT REPRESENTATION In decimal notation, the number 23.456 can be written as 0.23456 x 10 2. This means that in decimal notation,

More information

Floating-Point Arithmetic

Floating-Point Arithmetic Floating-Point Arithmetic ECS30 Winter 207 January 27, 207 Floating point numbers Floating-point representation of numbers (scientific notation) has four components, for example, 3.46 0 sign significand

More information

Definition. A Taylor series of a function f is said to represent function f, iff the error term converges to 0 for n going to infinity.

Definition. A Taylor series of a function f is said to represent function f, iff the error term converges to 0 for n going to infinity. Definition A Taylor series of a function f is said to represent function f, iff the error term converges to 0 for n going to infinity. 120202: ESM4A - Numerical Methods 32 f(x) = e x at point c = 0. Taylor

More information

MAT128A: Numerical Analysis Lecture Two: Finite Precision Arithmetic

MAT128A: Numerical Analysis Lecture Two: Finite Precision Arithmetic MAT128A: Numerical Analysis Lecture Two: Finite Precision Arithmetic September 28, 2018 Lecture 1 September 28, 2018 1 / 25 Floating point arithmetic Computers use finite strings of binary digits to represent

More information

ME 261: Numerical Analysis. ME 261: Numerical Analysis

ME 261: Numerical Analysis. ME 261: Numerical Analysis ME 261: Numerical Analysis 3. credit hours Prereq.: ME 163/ME 171 Course content Approximations and error types Roots of polynomials and transcendental equations Determinants and matrices Solution of linear

More information

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number

More information

Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee

Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee ١ Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee Digital systems Digital systems are used in communication, business transactions, traffic control, spacecraft guidance, medical

More information

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

CHW 261: Logic Design

CHW 261: Logic Design CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER

More information

Signed umbers. Sign/Magnitude otation

Signed umbers. Sign/Magnitude otation Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,

More information

Unit 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers

Unit 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers Contents STRAND B: Number Theory Unit 7 Number System and Bases Student Text Contents Section 7. Number System 7.2 Binary Numbers 7.3 Adding and Subtracting Binary Numbers 7.4 Multiplying Binary Numbers

More information

Floating Point Representation in Computers

Floating Point Representation in Computers Floating Point Representation in Computers Floating Point Numbers - What are they? Floating Point Representation Floating Point Operations Where Things can go wrong What are Floating Point Numbers? Any

More information

These are reserved words of the C language. For example int, float, if, else, for, while etc.

These are reserved words of the C language. For example int, float, if, else, for, while etc. Tokens in C Keywords These are reserved words of the C language. For example int, float, if, else, for, while etc. Identifiers An Identifier is a sequence of letters and digits, but must start with a letter.

More information

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014 Problem 1 (4 parts, 21 points) Encoders and Pass Gates Part A (8 points) Suppose the circuit below has the following input priority: I 1 > I 3 > I 0 > I 2. Complete the truth table by filling in the input

More information

Computer Organisation CS303

Computer Organisation CS303 Computer Organisation CS303 Module Period Assignments 1 Day 1 to Day 6 1. Write a program to evaluate the arithmetic statement: X=(A-B + C * (D * E-F))/G + H*K a. Using a general register computer with

More information

Accuracy versus precision

Accuracy versus precision Accuracy versus precision Accuracy is a consistent error from the true value, but not necessarily a good or precise error Precision is a consistent result within a small error, but not necessarily anywhere

More information

Review of Number Systems

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

More information

Data Representation Floating Point

Data Representation Floating Point Data Representation Floating Point CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides via Jason Fritts Today: Floating Point Background:

More information

Objectives. Connecting with Computer Science 2

Objectives. Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn how numbering systems are used to count Understand the significance of positional value

More information

Lecture 03 Approximations, Errors and Their Analysis

Lecture 03 Approximations, Errors and Their Analysis AM702 Applied Computational Methods c ecture 03 Approximations, rrors and heir Analysis Approximations and rrors c Approximation is unavoidable in mathematical modeling the real world phenomena Approximation

More information

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

Numeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects: Numeral Systems -Numeral System -Positional systems -Decimal -Binary -Octal Subjects: Introduction A numeral system (or system of numeration) is a writing system for expressing numbers, that is a mathematical

More information

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

More information

Data Representation Floating Point

Data Representation Floating Point Data Representation Floating Point CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides via Jason Fritts Today: Floating Point Background:

More information

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

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation Data Representation II CMSC 313 Sections 01, 02 The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the high-order bit

More information

Introduction to Scientific Computing Lecture 1

Introduction to Scientific Computing Lecture 1 Introduction to Scientific Computing Lecture 1 Professor Hanno Rein Last updated: September 10, 2017 1 Number Representations In this lecture, we will cover two concept that are important to understand

More information

FLOATING POINT NUMBERS

FLOATING POINT NUMBERS FLOATING POINT NUMBERS Robert P. Webber, Longwood University We have seen how decimal fractions can be converted to binary. For instance, we can write 6.25 10 as 4 + 2 + ¼ = 2 2 + 2 1 + 2-2 = 1*2 2 + 1*2

More information

COSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture)

COSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture) COSC 243 Data Representation 3 Lecture 3 - Data Representation 3 1 Data Representation Test Material Lectures 1, 2, and 3 Tutorials 1b, 2a, and 2b During Tutorial a Next Week 12 th and 13 th March If you

More information

CS 101: Computer Programming and Utilization

CS 101: Computer Programming and Utilization CS 101: Computer Programming and Utilization Jul-Nov 2017 Umesh Bellur (cs101@cse.iitb.ac.in) Lecture 3: Number Representa.ons Representing Numbers Digital Circuits can store and manipulate 0 s and 1 s.

More information

Computer Arithmetic. 1. Floating-point representation of numbers (scientific notation) has four components, for example, 3.

Computer Arithmetic. 1. Floating-point representation of numbers (scientific notation) has four components, for example, 3. ECS231 Handout Computer Arithmetic I: Floating-point numbers and representations 1. Floating-point representation of numbers (scientific notation) has four components, for example, 3.1416 10 1 sign significandbase

More information

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

D I G I T A L C I R C U I T S E E D I G I T A L C I R C U I T S E E Digital Circuits Basic Scope and Introduction This book covers theory solved examples and previous year gate question for following topics: Number system, Boolean algebra,

More information

Floating Point Arithmetic

Floating Point Arithmetic Floating Point Arithmetic Clark N. Taylor Department of Electrical and Computer Engineering Brigham Young University clark.taylor@byu.edu 1 Introduction Numerical operations are something at which digital

More information

unused unused unused unused unused unused

unused unused unused unused unused unused BCD numbers. In some applications, such as in the financial industry, the errors that can creep in due to converting numbers back and forth between decimal and binary is unacceptable. For these applications

More information

Decimal Binary Conversion Decimal Binary Place Value = 13 (Base 10) becomes = 1101 (Base 2).

Decimal Binary Conversion Decimal Binary Place Value = 13 (Base 10) becomes = 1101 (Base 2). DOMAIN I. NUMBER CONCEPTS Competency 00 The teacher understands the structure of number systems, the development of a sense of quantity, and the relationship between quantity and symbolic representations.

More information

Chapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude

Chapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude Chapter 2 Positional number systems A positional number system represents numeric values as sequences of one or more digits. Each digit in the representation is weighted according to its position in the

More information

Chapter Three. Arithmetic

Chapter Three. Arithmetic Chapter Three 1 Arithmetic Where we've been: Performance (seconds, cycles, instructions) Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's up ahead: Implementing

More information