Natural Numbers and Integers. Big Ideas in Numerical Methods. Overflow. Real Numbers 29/07/2011. Taking some ideas from NM course a little further

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

CMPSCI 145 MIDTERM #2 SPRING 2017 April 7, 2017 Professor William T. Verts NAME PROBLEM SCORE POINTS GRAND TOTAL 100

15213 Recitation 2: Floating Point

Floating Point Arithmetic

Interactive Graphics. Lecture 9: Introduction to Spline Curves. Interactive Graphics Lecture 9: Slide 1

CS321 Introduction To Numerical Methods

Data Representation Floating Point

Floating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column

Data Representation Floating Point


Floating Point Numbers

CMPSCI 145 MIDTERM #2 Solution Key SPRING 2018 April 13, 2018 Professor William T. Verts

Computer Systems C S Cynthia Lee

Lecture 9: Introduction to Spline Curves

Floating Point January 24, 2008

EE 109 Unit 19. IEEE 754 Floating Point Representation Floating Point Arithmetic

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

CSCI 402: Computer Architectures. Arithmetic for Computers (3) Fengguang Song Department of Computer & Information Science IUPUI.

February 23 Math 2335 sec 51 Spring 2016

Floating-point representation

Number Systems. Both numbers are positive

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Foundations of Computer Systems

Floating Point. CSC207 Fall 2017

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

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

Computational Methods CMSC/AMSC/MAPL 460. Representing numbers in floating point and associated issues. Ramani Duraiswami, Dept. of Computer Science

Floating Point Numbers

Floating Point Numbers

Chapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation

Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science)

2 Computation with Floating-Point Numbers

Floating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers.

ECE232: Hardware Organization and Design

Floating Point Numbers

AM205: lecture 2. 1 These have been shifted to MD 323 for the rest of the semester.

Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754

Floating Point Arithmetic

Representing and Manipulating Floating Points. Jo, Heeseung

World Inside a Computer is Binary

2 Computation with Floating-Point Numbers

Divide: Paper & Pencil

What we need to know about error: Class Outline. Computational Methods CMSC/AMSC/MAPL 460. Errors in data and computation

Systems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties

Reals 1. Floating-point numbers and their properties. Pitfalls of numeric computation. Horner's method. Bisection. Newton's method.

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

Chapter 3: Arithmetic for Computers

Floating point. Today. IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.

unused unused unused unused unused unused

MATH 353 Engineering mathematics III

Computational Methods CMSC/AMSC/MAPL 460. Representing numbers in floating point and associated issues. Ramani Duraiswami, Dept. of Computer Science

COMP2611: Computer Organization. Data Representation

M1 Computers and Data

FLOATING POINT NUMBERS

Up next. Midterm. Today s lecture. To follow

CMPSCI 145 MIDTERM #1 Solution Key. SPRING 2017 March 3, 2017 Professor William T. Verts

Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754

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

Floating Point Numbers. Lecture 9 CAP

System Programming CISC 360. Floating Point September 16, 2008

Computer System and programming in C

Floating Point Arithmetic

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

Mathematical preliminaries and error analysis

CS429: Computer Organization and Architecture

Programming Using C Homework 4

Representing and Manipulating Floating Points

Review of Calculus, cont d

Representing and Manipulating Floating Points

Floating Point : Introduction to Computer Systems 4 th Lecture, May 25, Instructor: Brian Railing. Carnegie Mellon

Giving credit where credit is due

Chapter Three. Arithmetic

3.5 Floating Point: Overview

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

Giving credit where credit is due

Number Systems CHAPTER Positional Number Systems

Finite arithmetic and error analysis

Floating Point Representation. CS Summer 2008 Jonathan Kaldor

Representing and Manipulating Floating Points

Floating Point. EE 109 Unit 20. Floating Point Representation. Fixed Point

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

On a 64-bit CPU. Size/Range vary by CPU model and Word size.

Introduction to Computers and Programming. Numeric Values

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

3 Data Storage 3.1. Foundations of Computer Science Cengage Learning

EE 109 Unit 20. IEEE 754 Floating Point Representation Floating Point Arithmetic

Basic data types. Building blocks of computation

Derivative. Bernstein polynomials: Jacobs University Visualization and Computer Graphics Lab : ESM4A - Numerical Methods 313

Data Representation in Computer Memory

Chapter 3. Errors and numerical stability

Exponential Numbers ID1050 Quantitative & Qualitative Reasoning

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

Digital Computers and Machine Representation of Data

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers

Numerical computing. How computers store real numbers and the problems that result

CS130 : Computer Graphics Curves (cont.) Tamar Shinar Computer Science & Engineering UC Riverside

08 - Designing Approximating Curves

CREATING FLOATING POINT VALUES IN MIL-STD-1750A 32 AND 48 BIT FORMATS: ISSUES AND ALGORITHMS

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

Transcription:

Natural Numbers and Integers Big Ideas in Numerical Methods MEI Conference 2011 Natural numbers can be in the range [0, 2 32 1]. These are known in computing as unsigned int. Numbers in the range [ (2 31 ), 2 31 1] can are known in computing as int. In maths, natural numbers are a subset of the integers. In computing unsigned int is not a subset of int and int is not a subset of unsigned int! Taking some ideas from NM course a little further How computers store numbers, shedding a little more light on problems with relative error Interpolating curves different forms such as Hermite and Bezier curves Overflow Overflow is a term used to describe what occurs when a computation generates a results outside the range of the representation in use. For natural numbers/unsigned int, starting from 0 and incrementing once per frame, with a frame rate of 100 frames per second results in overflow after about 1.4 years. Negative overflow is a more common occurrence in unsigned int Real world computer number representation Computers can only represent a finite number of different values. As a result computers cannot represent any of the natural numbers, integers or real numbers exactly and completely. An n bit computer can only represent 2 n distinct values of each set. Real Numbers In mathematics we know that the size of the real numbers is even greater than that of the integers or the natural numbers. A 32 bit computer still can only represent 2 32 different real numbers. There are two different ways that computers do this, fixed point representation and floating point representation. 1

Fixed Point Example for an 8 bit computer. We might have 4 dot 4 representation 2 3 2 2 2 1 2 0. 2 1 2 2 2 3 2 4 The standard nomenclature for a fixed point format is M dot N where M is the number of places before the decimal point and N is the number of places after it. Floating Point Numbers (181) This is analogous to scientific notation. It has the form mantissa x 10 exponent.but with some extra rules The mantissa has a fixed number of fractional digits. The exponent has a fixed number of digits. The mantissa and exponent each have individual signs Conversion between Real and Fixed Point To convert a real number, r, to M dot N format: Let F = round (2 N r) Take binary form of F Insert decimal point after M digits Examples: 4.5 to 4 dot 4 7.3 to 4 dot 4 Binary floating point numbers In binary our restricted scientific notation would become Sign M x Mantissa x 2Sign E x Exponent Where Mantissa is a 1 dot M fixed point number, Exponent is an E bit integer and Sign M and Sign E are independent bits giving the signs of the mantissa and exponent. This means the format involves M + 1 + E + 2 = M + E + 3 bits. Limits of fixed point For a 32 bit computer 16 dot 16 is representative. Given that one bit is used for +/ this means that that maximum representable value is 32767 minimum representable value is about 32768 distance between adjacent representable values about 1.5 x 10 5 Example 8 bit, M = 3, E = 2 A number in this form might be ` 1.010 x 2 11 This is 1.25 x 2 3 In this system the maximum representable value is 1.875 x 23 = 15 and the smallest value is 15. The smallest positive value is 1.000 x 2 3 = 0.125. The smallest gap between consecutive values is 0.125 x 2 3 = 0.015625 2

32 bit M = 23, E = 8 Here the maximum and minimum values are +/ 3.402823466 x 10 38 The difference between a value and it s nearest neighbour is about 2 23 which is approximately 6 x 10 8. Piecewise Linear Piecewise linear functions clearly give rise to discontinuities in the derivative at the interpolating points. So the greatest error in storing a real number is around 3 x 10 8 Note that programs like Excel actually achieve much greater accuracy than this by use of Curves In the Numerical Methods course, the Lagrange Polynomial and the Newton Interpolating Polynomial are the given methods for fitting a curve to points. In the real world the Lagrange polynomial is fine for interpolating small data sets. One problem with Lagrange and Newton in computer animation is that the function depends on all the points, so if an animator tweaks their values throughout the development the whole function needs to be recalculated. Lagrange polynomials also run into numerical problems with larger and larger numbers of points. Suppose you have two points and two specified gradients at each point. Curves Trying to build a single parametric curve by using all the points is not always a productive method Let s return to the idea of piecewise equations You would like to join these with a curve that has that gradient at each point. 3

Bezier Curves Bézier curves were widely publicized in 1962 by the French engineer Pierre Bézier, who used them to design automobile bodies. The curves were first developed in 1959 by Paul de Casteljau Quadratic Bezier Curves Start with three points Demonstration http://staff.www.ltu.se/~peppar/presentation s/bibdc961114/misc_applets/paramcurve/ http://www.rosehulman.edu/~finn/ccli/applets/cubichermite Applet.html Cubic Bezier Curves Start with four points 4

http://en.wikipedia.org/wiki/b%c3%a9zier_cu rve http://www.geogebra.org/en/upload/files/en glish/oldknow/ggb4a_bezier_curves.html 5