Decimal Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm Harder.

Slides:



Advertisements
Similar presentations
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Advertisements

ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Laplace Transform Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2008 by Douglas Wilhelm Harder.
Topics in Applied Mathematics Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Chapter 5 Floating Point Numbers. Real Numbers l Floating point representation is used whenever the number to be represented is outside the range of integer.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Floating Point Numbers.  Floating point numbers are real numbers.  In Java, this just means any numbers that aren’t integers (whole numbers)  For example…
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Binary Representation and Computer Arithmetic
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Fixed-Point Iteration Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm.
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Welcome to ECE 204 Numerical Methods for Computer Engineers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo.
Proof by Induction.
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
Data Representation in Computer Systems
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
1. Scientific Notation Every positive number X can be written as:
Binary Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm Harder.
Operations with Scientific Notation. Addition and Subtraction Format Addition (N * 10 x ) + (M * 10 x ) = (N + M) * 10 x Subtraction (N * 10 y ) - (M.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
CSC 221 Computer Organization and Assembly Language
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
16. Binary Numbers Programming in C++ Computer Science Dept Va Tech August, 1999 © Barnette ND, McQuain WD, Keenan MA 1 Binary Number System Base.
Introduction to Numerical Analysis I MATH/CMPSC 455 Binary Numbers.
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Problems with Floating-Point Representations Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright.
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 5 Number Theory and the Real Number System.
Double-Precision Floating-Point Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007.
Scientific Notation AP Chemistry August 11 th, 2015.
Floating Point in Binary 1.Place Value Chart:
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Scientific Notation INTEGRATED MATHEMATICS. A number is written in scientific notation when it is expressed in the form below where a is greater than.
SCIENTIFIC NOTATION Expressing a quantity as: a number between 1 and 10 multiplied by 10 to the appropriate power.
Scientific Notation. Scientific (Exponential) Notation A number is written as the product of two numbers, a coefficient and 10 raised to a power 36,000.
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
WATERLOO ELECTRICAL AND COMPUTER ENGINEERING Complaints, Discipline and Enforcement 1 WATERLOO ELECTRICAL AND COMPUTER ENGINEERING Professional Engineers.
1 The tree data structure Outline In this topic, we will cover: –Definition of a tree data structure and its components –Concepts of: Root, internal, and.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
1 N -ary trees This topic quickly looks at a generalization of a binary tree, where each node has up to N children –Definition –Perfect N -ary trees –Complete.
1 Complete binary trees Outline Introducing complete binary trees –Background –Definitions –Examples –Logarithmic height –Array storage.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
Floating Point Numbers
Introduction to Numerical Analysis I
Fundamentals of Computer Science
SCIENTIFIC NOTATION LESSON 19.
Scientific Notation.
Apply the power of a product property to a monomial algebraic expression
Open Addressing: Quadratic Probing
Scientific Notation.
Outline Introducing perfect binary trees Definitions and examples
Quantitative Measurements
REALLY BIG & REALLY small Numbers
SCIENTIFIC NOTATION.
Section 4.3 Scientific Notation.
Scientific Notation.
Scientific Notation.
Converting from Base-n to Base-10
Floating Point Binary Part 1
Scientific Notation Students will learn the uses of Scientific Notation and apply the lesson into their studies.
Presentation transcript:

Decimal Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm Harder. All rights reserved. ECE 204 Numerical Methods for Computer Engineers

Decimal Numbers This topic is a quick review of decimal numbers, both integers and real numbers –standard notation –scientific notation –addition –multiplication

Decimal Numbers We represent an integer as a sequence of decimal digits: d n d n – 1 d n – 2 · · · d 2 d 1 d 0 where d n  0 This represents the number

Decimal Numbers For example, represents or 2· · · · · ·10 0

Decimal Numbers The sequence of integers is 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,..., 17, 18, 19, 20, 21,... where we increment the next decimal digit to the left whenever we add one to a 9 Note that there is nothing special about “ten”, the base of our number system Our decimal system uses ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Decimal Numbers We represent a real number as a sequence of decimal digits: d n d n – 1 · · · d 1 d 0. d –1 d –2 d –3 · · · where d n  0, and n is any integer This represents the number

Decimal Numbers For example,  = ··· represents ··· or 3· ·10 –1 + 4·10 –2 + 1·10 –3 + 4·10 –4 + 9·10 –5 + ···

Decimal Numbers We cannot store an infinite number of decimal digits, and therefore, we approximate real numbers using a finite number of decimal digits: d n d n – 1 · · · d 0. d –1 · · · d m where d n  0, n is any integer and m  n This represents the number

Decimal Numbers For example, represents or 2· · · ·10 –1 + 3·10 –1 + 2·10 –2 Also, 3.14 represents = 3· ·10 –1 + 4·10 –2

Decimal Numbers These formats can be inconvenient if n and m are either both very large or both very small: and thus it is common to use scientific notation to represent real numbers or their approximations

Decimal Numbers Any real number can be written as d 0.d -1 d -2 d -3 · · · d –m  10 n where d 0  0 This is often more conveniently written as d 0.d -1 d -2 d -3 ···d –m en where n is the exponent, e denotes exponent, and the digits d 0.d -1 d -2 d -3 ···d are the mantissa

Decimal Numbers For example: – may be written as  10 2 or e2 –3.14 may be written as 3.14  10 0 or 3.14e0 – may be written as  or 5.232e13 – may be written as  10 –14 or 5.232e-14

Decimal Numbers To add two decimal numbers: –line up the decimal points, add the columns, carrying 1 to next column if the sum is greater than 9 : –for example, add = e3 and = e0 yielding e3

Decimal Numbers Multiplication of numbers in scientific notation is similar, multiply the mantissa and add the exponents –for example, multiply = 2.7e4 and 0.32 = 3.2e-1 yielding 8.64e3 where 3 = 4 + –1

Decimal Numbers In both addition and multiplication, an adjustment may have to be made to keep the numbers in scientific notation For example, 9.25e e0 = 14.48e0 = 1.448e1

Decimal Numbers The justification for these apparently obvious examples is that we will next be working with binary numbers –computers can only store binary numbers –the representation is slightly different, but the operations are the same

Usage Notes These slides are made publicly available on the web for anyone to use If you choose to use them, or a part thereof, for a course at another institution, I ask only three things: –that you inform me that you are using the slides, –that you acknowledge my work, and –that you alert me of any mistakes which I made or changes which you make, and allow me the option of incorporating such changes (with an acknowledgment) in my set of slides Sincerely, Douglas Wilhelm Harder, MMath