Finite arithmetic and error analysis
|
|
- Brooke Tyler
- 5 years ago
- Views:
Transcription
1 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
2 Outline 1 Number representation: decimal and binary 2 Float point representation: standard IEEE Accuracy 4 Rounding 5 Error (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 2 / 45
3 Number representation: decimal and binary Outline 1 Number representation: decimal and binary 2 Float point representation: standard IEEE Accuracy 4 Rounding 5 Error (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 3 / 45
4 Storing numbers Number representation: decimal and binary Numbers are stored in computers using two main formats: Integer format: exact storing of a finite set of integer numbers Floating point format: exact storing of a finite set of rational numbers The standard floating point representation is the IEEE 754 format (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 4 / 45
5 Number representation: decimal and binary Number representation: decimal The decimal floating point representation of a real number, x 0, is with σ = ±1, the sign, x R, the mantisse, n Z, the exponent x = σ ( x) n, Example: The normalized floating point representation of x = = is with a precision of 5 digits σ = +1, x = 31415, e = 2 (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 5 / 45
6 Number representation: decimal and binary Number representation: binary Similarly, the binary floating point representation of a real number, x 0, is x = σ ( x) 2 2 e The representation is said to be normalized if Decimal case: (1) 10 x < (10) 10 Binary case: (1) 2 x < (10) 2 Example: The normalized floating point representation of x = ( ) 2 = ( ) is with a precision of 5 digits σ = +1, x = ( ) 2, e = (4) 1 0 (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 6 / 45
7 Number representation: decimal and binary Significant digits and precision Significant digits of a number: digits of the mantissa, not counting leading zeros For normalized numbers, significant digits = number of digits in the mantissa Precision of a representation: maximum number, p, of significant digits that can be represented For a normalized representation, p = number of digits in the mantissa The precision may be finite, if p <, or infinite, if there is no limit to the number of digits in the mantissa (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 7 / 45
8 Number representation: decimal and binary Significant digits and precision x = ( ) 2 = ( ) 10 normalized floating point decimal representation with: σ = +1, x = , n = 0, normalized binary floating point representation with: σ = (1) 2, x = ( ) 2, e = (2) 10 = (10) 2 Thus, the number of significant digits is: 7 for the decimal representation, 9 for the binary representation (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 8 / 45
9 Number representation: decimal and binary Conversion from binary to decimal In the decimal system the number means: (107625) 10 = Similarly, in the binary system numbers are represented as an expansion of powers of 2: ( ) 2 = Conversion from binary to decimal is straightforward, performing the sum: ( ) 2 = = (107625) 10 (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 9 / 45
10 Number representation: decimal and binary Conversion from decimal to binary (two steps): Integer part We sequentially divide by 2 and keep the remainders as the digits in base 2 We first write the last quotient that is not zero (it is always 1) and then the remainders, from right to left: Quotients Remainders Fractional part We sequentially multiply by 2 and subtract the integer part The binary digits are the remainders, written from left to right: Fractional Integer The result is: (107625) 10 = ( ) 2 (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 10 / 45
11 Number representation: decimal and binary Example: integer representation with 4 bits Binary Unsigned Unsigned Signed Signed representation integers integers integers integers (Exp) (m = 4 bits) (signo en 1 er bit) bias = 2 m 1 bias = 2 m Reserved Reserved (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 11 / 45
12 Float point representation: standard IEEE 754 Outline 1 Number representation: decimal and binary 2 Float point representation: standard IEEE Accuracy 4 Rounding 5 Error (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 12 / 45
13 Float point representation: standard IEEE 754 Standard IEEE 754 IEEE stands for Institute of Electrical and Electronics Engineers The standard IEEE 754 is the one used for floating point representation in computers and is used by almost all the processors Basic format floating-point numbers Binary format (b = 2) Decimal format (b = 10) parameter binary32 binary64 binary128 decimal64 decimal128 p, digits (p) e max e min = 1 e max There also exist extended and extendable precisions and they are recommended for extending the precisions used for arithmetic beyond the basic formats (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 13 / 45
14 Float point representation: standard IEEE 754 Standard IEEE 754 The IEEE 754 floating point binary representation of a number x 0 is x = σ x 2 e First bit for the sign, σ: 0 for positive, 1 for negative The exponent, e, is a signed integer following the IEEE 754 biased representation The mantissa is normalized: 1 x < (10) 2 This implies that the first digit must be 1, and then it is unnecessary to store it (a bit is saved) This is the hidden bit technique (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 14 / 45
15 Float point representation: standard IEEE 754 Single precision or binary32 sign exponent mantissa x = σ (1a 1 a 2 a 23 ) 2 e The numbers are encoded with 32 bits (4 bytes): 1 bit for the sign 8 bits for the exponent 23 bits for the mantissa (plus hidden bit = precision p = 24) Exponent bias is 2 m 1 1 = 127 = e [ 126, 127] (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 15 / 45
16 Float point representation: standard IEEE 754 Double precision or binary64 sign exponent mantissa x = σ (1a 1 a 2 a 52 ) 2 e The numbers are encoded with 64 bits (8 bytes): 1 bit for the sign 11 bits for the exponent 52 bits for the mantissa (plus hidden bit = precision p = 53) Exponent bias is 2 m 1 1 = 1023 = e [ 1022, 1023] (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 16 / 45
17 Float point representation: standard IEEE 754 Example: from decimal to binary32 ( ) 10 Mantissa For the fractional part, we get Fractional : Integer : and therefore, we store (0101) 2 For the integer part, we obtain Quotients : Remainders : and thus we store ( ) 2 The complete mantissa is written as ( ) 2 Following the IEEE standard, we normalize the mantissa as = , Due to the hidden bit technique, the first 1 is omitted and it is stored as (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 17 / 45
18 Float point representation: standard IEEE 754 Example: from decimal to binary32 Exponent The bias is 2 m 1 1 = 127 The base 10 biased exponent is then 6 + bias = = 133 Computing its binary representation we get ( ) 2 Quotients : Remainders : Sign Since the number is negative, the sign bit is 1 Therefore, the answer is sign exponent mantissa (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 18 / 45
19 Float point representation: standard IEEE 754 Special values (single precision) The largest exponent is e = ( ) 2 This exponent is reserved for: Infinity All the mantissa digits are zeros It is due to overflow Value sign exponent mantissa NaN (Not a Number) The mantissa is not identically zero There are two kind: QNaN (Quiet NaN), meaning indeterminate, and SNaN (Signaling NaN) meaning invalid operation Attempts to compute 0/0, 0 0, or similar expressions result in NaN Value sign exponent mantissa SNaN QNaN (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 19 / 45
20 Float point representation: standard IEEE 754 Special values (single precision) The smallest exponent is e = ( ) 2 This exponent is reserved for: Zero Since HB = 1, it is not representable as a normalized number: Value sign exponent mantissa Denormalized numbers We set HB = 0, and e = ( ) 2, although it is still represented with For example, sign exponent mantissa Advantage: since HB = 0, numbers smaller than the smallest normalized number may be represented However, the precision is smaller, since they have leading zeroes (at least, the hidden bit) (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 20 / 45
21 Example Float point representation: standard IEEE 754 Compute the base 10 value and the precision representation of the number sign exponent mantissa Since the exponent is and the mantissa is not identically zero, the number is denormalized Thus, the exponent is e min = 126, and the hidden bit is 0 Therefore, it represents the number ( ) 2 126, with precision p = 24 4 = 20 In decimal base, is given by ( ) that it is less than R min = (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 21 / 45
22 Example Float point representation: standard IEEE 754 Compute the smallest denormalized numbers in single and double precision In single precision, it is sign exponent mantissa representing, in binary base, ( ) = = , which has a precision p = 1 Similarly, in double precision we get (2 52 ) = (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 22 / 45
23 Accuracy Outline 1 Number representation: decimal and binary 2 Float point representation: standard IEEE Accuracy 4 Rounding 5 Error (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 23 / 45
24 Accuracy Accuracy We have two main ways of measuring the accuracy of floating point arithmetics: The machine epsilon, ɛ, which is the difference between 1 and the next number, x > 1, which is representable The largest integer, M, such that any other positive integer, x M, is representable (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 24 / 45
25 Accuracy Machine epsilon: single precision The normalized format in single precision is σ (1a 1 a 2 a 22 a 23 ) 2 e If we write 1 in this format +1 (100 00) 2 0 the next number that can be stored in this format is 1 + ɛ = +1 (100 01) 2 0 The machine epsilon ɛ is the gap between these two numbers ɛ = +1 (000 01) 2 0 that normalized is written ɛ = +1 (100 00) 2 23 then ɛ = (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 25 / 45
26 Accuracy Machine epsilon: double precision The normalized format in double precision is σ (1a 1 a 2 a 51 a 52 ) 2 e If we write 1 in this format +1 (100 00) 2 0 the next number that can be stored in this format is 1 + ɛ = +1 (100 01) 2 0 The machine epsilon ɛ is the gap between these two numbers ɛ = +1 (000 01) 2 0 that normalized is written ɛ = +1 (100 00) 2 52 then ɛ = (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 26 / 45
27 Accuracy Machine epsilon IEEE simple precission: ɛ = (0 } 0 {{ 0 } 1) 2 = , 22 so we may store approximately 7 digits for a decimal number IEEE double precission: ɛ = (0 } 0 {{ 0 } 1) 2 = , 51 so we may store approximately 16 digits for a decimal number (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 27 / 45
28 Accuracy Largest integer: single precision The largest integer is M = 2 p For instance, for single precission (p = 24) Decimal Binary Mantissa Exp Representation represented 25 digits 1+23 bits Exact Exact Exact Exact Exact M = Exact Rounded Exact Rounded Exact (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 28 / 45
29 Accuracy Largest integer: double precision Decimal Binary Mantissa Exp Representation represented 54 digits 1+52 bits Exact Exact Exact Exact Exact Exact Rounded Exact Rounded Exact (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 29 / 45
30 Accuracy Largest integer Single IEEE precision : M = 2 24 = , and we can store exactly 6 digit integers Double IEEE precision: M = , and we can store exactly 15 digit integers and almost all 16 digit integers (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 30 / 45
31 Accuracy Overflow and underflow The largest normalized number that can be represented in double precision is, in binary format (±1) (111 11) In decimal format R max = ±( ) ± The smallest positive normalized number that can be represented in double precision is, in binary format In decimal format (±1) (100 00) R min = ± ± (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 31 / 45
32 Accuracy Overflow and underflow An overflow error is produced when trying to use a number too large (greater than the corresponding R max ): In most computers, execution is aborted IEEE format may support them by assigning the symbolic values ± or NaN An underflow error is produced when trying to use a number too small (less, in absolute value, than the corresponding R min ) Two possible behaviors: It lies in the range of denormalized numbers, so it is still representable In this case, precision decreases and it is called gradual underflow Otherwise, it is identified to 0 In both cases, execution continues (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 32 / 45
33 Rounding Outline 1 Number representation: decimal and binary 2 Float point representation: standard IEEE Accuracy 4 Rounding 5 Error (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 33 / 45
34 Rounding Rounding When operations lead to a number with a mantissa containing more digits than the precision, the number must be approximated by another representable number In the norm IEEE 754 we have five procedures to approximate x: Round up: taking the closest representable larger number Round down: taking the closest representable smaller number Round towards zero (truncation): replacing the non representable digits by zero Round towards infinity: taking the closest that is the farthest from the zero Round to the nearest even representable digit (rounding) The most usual procedures are truncation and rounding (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 34 / 45
35 Rounding Decimal representation rounding Consider the base 10 number ( x = ±d 0 d 1 d 2 10 n = ± d k 10 k) 10 n, (1) with d k = 0, 1,, 9, for all k, and d 0 0 We have, for a precision of p digits, Truncation: x = ±d 0 d 1 d 2 d p 1 10 n k=0 Rounding: ±d 0 d 1 d 2 d p 1 10 n if 0 d p 4, x = ± ( d 0 d 1 d 2 d p (p 1)) 10 n if 5 < d p 9, nearest number ending in even if d p = 5, d p+k = 0 for all k > 0 (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 35 / 45
36 Rounding Example Example: x = and p = 4 Truncation x = Rounding x = 1000 Example: x = and p = 3 Truncation x = 0433 Rounding x = 0433 Example: x = and p = 3 Truncation x = 0433 Rounding x = 0434 (towards the nearest even representable digit) Example x = and p = 3 Truncation x = 0434 Rounding x = 0434 (towards the nearest even representable digit) (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 36 / 45
37 Rounding Binary representation rounding In this case, the number takes the form ( x = ±1b 1 b 2 2 e = ± b k 2 k) 2 e, with b k = 0, 1 for all k For a precision p (including the hidden bit), we have Truncation: x = ±1b 1 b 2 b p 1 2 e k=0 Rounding: ±1b 1 b 2 b p 1 2 e if b p = 0, x = ± ( 1b 1 b 2 b p (p 1)) 2 e if b p = 1 and b p+k = 1 for some k > 0, nearest number ending in 0 if b p = 1 and b p+k = 0 for all k > 0 (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 37 / 45
38 Rounding Example Example: Para x = y p = 3 Truncation x = 111 Rounding x = 100 Example: Para x = y p = 3 Truncation x = 111 Rounding x = 111 Example: Para x = y p = 3 Truncation x = 100 Rounding x = 100 (towards the nearest even representable digit) Example: Para x = y p = 3 Truncation x = 101 Rounding x = 110 (towards the nearest even representable digit) (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 38 / 45
39 Rounding Truncation versus rounding in the binary system If truncating, we have ( x xt = b k 2 k) 2 e 2 (p 1) 2 e, k=p where we used the formula for summing a geometric series If rounding, x, is always, at worst, halfway between the two nearest representable numbers Thus, Consequences: x x r (p 1) 2 e = 2 p 2 e Largest truncation error is double of largest rounding error Truncation error is always non-positive, while rounding error may change sign (and compensate) Therefore, errors are less amplified when using rounding (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 39 / 45
40 Rounding Example Let x = ( ) 2 We approximate by Truncation to 5 binary digits, x t = (11001) 2 Then x x t = ( ) 2 = = Rounding to 5 binary digits, x r = (11010) 2 In this case x x r = ( ) 2 = = (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 40 / 45
41 Error Outline 1 Number representation: decimal and binary 2 Float point representation: standard IEEE Accuracy 4 Rounding 5 Error (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 41 / 45
42 Error Numerical instability Rounding errors arising in finite arithmetic computation are small in each computation, but may accumulate and propagate when an algorithm consists of many computations or iterations, resulting in a large difference between the exact solution and the solution computed numerically This effect is known as numerical instability of an algorithm (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 42 / 45
43 Error Example Consider the sequence s k = k, for k = 1, 2,, and compute whose result is just However, in simple precision we obtain x k = 1 s k + 2 s k + + k s k, x k = 1 for all k = 1, 2, k xk x k xk (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 43 / 45
44 Error Absolute and relative errors There are two main measures of the error made when approximating a number x by an approximation x : Absolute error: e a = x x Relative error: e r = x x x Relative error is independent of the scale and thus often more meaningful than absolute error, as we see in the following example: x x e a e r (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 44 / 45
45 Error Significant digits We say that x approximates x with p significant digits if p is the largest nonnegative integer such that x x x 5 10 p Examples: x = approximates x = with p = 2 meaningful digits: x x x = = = x = approximates x = with p = 2 digits: x x x = = = x = 9998 approximates x = 1000 with p = 4 meaningful digits: x x x = = = (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 45 / 45
CSCI 402: Computer Architectures. Arithmetic for Computers (3) Fengguang Song Department of Computer & Information Science IUPUI.
CSCI 402: Computer Architectures Arithmetic for Computers (3) Fengguang Song Department of Computer & Information Science IUPUI 3.5 Today s Contents Floating point numbers: 2.5, 10.1, 100.2, etc.. How
More information1.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 informationData 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 informationData 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 informationFloating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754
Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that
More informationFloating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science)
Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science) Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition Example and properties
More informationFloating Point January 24, 2008
15-213 The course that gives CMU its Zip! Floating Point January 24, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties class04.ppt 15-213, S 08 Floating
More informationFloating Point Numbers
Floating Point Numbers Summer 8 Fractional numbers Fractional numbers fixed point Floating point numbers the IEEE 7 floating point standard Floating point operations Rounding modes CMPE Summer 8 Slides
More informationFloating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !
Floating point Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties Next time! The machine model Chris Riesbeck, Fall 2011 Checkpoint IEEE Floating point Floating
More informationChapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation
Chapter 2 Float Point Arithmetic Topics IEEE Floating Point Standard Fractional Binary Numbers Rounding Floating Point Operations Mathematical properties Real Numbers in Decimal Notation Representation
More informationFloating-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 information2 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 informationFloating Point Numbers
Floating Point Floating Point Numbers Mathematical background: tional binary numbers Representation on computers: IEEE floating point standard Rounding, addition, multiplication Kai Shen 1 2 Fractional
More informationNumeric Encodings Prof. James L. Frankel Harvard University
Numeric Encodings Prof. James L. Frankel Harvard University Version of 10:19 PM 12-Sep-2017 Copyright 2017, 2016 James L. Frankel. All rights reserved. Representation of Positive & Negative Integral and
More informationSystems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties
Systems I Floating Point Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties IEEE Floating Point IEEE Standard 754 Established in 1985 as uniform standard for
More informationThe Sign consists of a single bit. If this bit is '1', then the number is negative. If this bit is '0', then the number is positive.
IEEE 754 Standard - Overview Frozen Content Modified by on 13-Sep-2017 Before discussing the actual WB_FPU - Wishbone Floating Point Unit peripheral in detail, it is worth spending some time to look at
More informationFloating Point Numbers
Floating Point Numbers Computer Systems Organization (Spring 2016) CSCI-UA 201, Section 2 Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU) Mohamed Zahran
More informationFloating Point Numbers
Floating Point Numbers Computer Systems Organization (Spring 2016) CSCI-UA 201, Section 2 Fractions in Binary Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU)
More informationFloating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers.
class04.ppt 15-213 The course that gives CMU its Zip! Topics Floating Point Jan 22, 2004 IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Floating Point Puzzles For
More informationFloating point. Today. IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.
Floating point Today IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time The machine model Fabián E. Bustamante, Spring 2010 IEEE Floating point Floating point
More informationChapter 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 informationCS321 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 informationFloating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754
Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that
More informationECE232: 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 informationFloating-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 informationRepresenting and Manipulating Floating Points
Representing and Manipulating Floating Points Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu The Problem How to represent fractional values with
More informationFloating-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 informationRoundoff 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 informationSystem Programming CISC 360. Floating Point September 16, 2008
System Programming CISC 360 Floating Point September 16, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Powerpoint Lecture Notes for Computer Systems:
More information2 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 informationNumber 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 informationCOMP2611: Computer Organization. Data Representation
COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How
More informationRepresenting and Manipulating Floating Points
Representing and Manipulating Floating Points Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE23: Introduction to Computer Systems, Spring 218,
More informationMathematical 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 informationIn this lesson you will learn: how to add and multiply positive binary integers how to work with signed binary numbers using two s complement how fixed and floating point numbers are used to represent
More informationFloating-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 informationFLOATING POINT NUMBERS
Exponential Notation FLOATING POINT NUMBERS Englander Ch. 5 The following are equivalent representations of 1,234 123,400.0 x 10-2 12,340.0 x 10-1 1,234.0 x 10 0 123.4 x 10 1 12.34 x 10 2 1.234 x 10 3
More informationCS 261 Fall Floating-Point Numbers. Mike Lam, Professor.
CS 261 Fall 2018 Mike Lam, Professor https://xkcd.com/217/ Floating-Point Numbers Floating-point Topics Binary fractions Floating-point representation Conversions and rounding error Binary fractions Now
More informationRepresenting and Manipulating Floating Points. Computer Systems Laboratory Sungkyunkwan University
Representing and Manipulating Floating Points Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu The Problem How to represent fractional values with
More informationFloating-point representations
Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010
More informationFloating-point representations
Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010
More informationCS 33. Data Representation (Part 3) CS33 Intro to Computer Systems VIII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.
CS 33 Data Representation (Part 3) CS33 Intro to Computer Systems VIII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. Byte-Oriented Memory Organization 00 0 FF F Programs refer to data by address
More informationGiving credit where credit is due
CSCE 230J Computer Organization Floating Point Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce230j Giving credit where credit is due Most of slides for this lecture are based
More informationChapter 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 informationCS 261 Fall Floating-Point Numbers. Mike Lam, Professor. https://xkcd.com/217/
CS 261 Fall 2017 Mike Lam, Professor https://xkcd.com/217/ Floating-Point Numbers Floating-point Topics Binary fractions Floating-point representation Conversions and rounding error Binary fractions Now
More informationGiving credit where credit is due
JDEP 284H Foundations of Computer Systems Floating Point Dr. Steve Goddard goddard@cse.unl.edu Giving credit where credit is due Most of slides for this lecture are based on slides created by Drs. Bryant
More informationComputer Organization: A Programmer's Perspective
A Programmer's Perspective Representing Numbers Gal A. Kaminka galk@cs.biu.ac.il Fractional Binary Numbers 2 i 2 i 1 4 2 1 b i b i 1 b 2 b 1 b 0. b 1 b 2 b 3 b j 1/2 1/4 1/8 Representation Bits to right
More informationRepresenting and Manipulating Floating Points
Representing and Manipulating Floating Points Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu The Problem How to represent fractional values with
More informationFloating Point : Introduction to Computer Systems 4 th Lecture, May 25, Instructor: Brian Railing. Carnegie Mellon
Floating Point 15-213: Introduction to Computer Systems 4 th Lecture, May 25, 2018 Instructor: Brian Railing Today: Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition
More informationData Representation Floating Point
Data Representation Floating Point CSCI 224 / ECE 317: Computer Architecture Instructor: Prof. Jason Fritts Slides adapted from Bryant & O Hallaron s slides Today: Floating Point Background: Fractional
More informationFloating-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 informationCS429: Computer Organization and Architecture
CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: September 18, 2017 at 12:48 CS429 Slideset 4: 1 Topics of this Slideset
More informationC NUMERIC FORMATS. Overview. IEEE Single-Precision Floating-point Data Format. Figure C-0. Table C-0. Listing C-0.
C NUMERIC FORMATS Figure C-. Table C-. Listing C-. Overview The DSP supports the 32-bit single-precision floating-point data format defined in the IEEE Standard 754/854. In addition, the DSP supports an
More informationFloating Point Arithmetic
Floating Point Arithmetic Computer Systems, Section 2.4 Abstraction Anything that is not an integer can be thought of as . e.g. 391.1356 Or can be thought of as + /
More informationBryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition. Carnegie Mellon
Carnegie Mellon Floating Point 15-213/18-213/14-513/15-513: Introduction to Computer Systems 4 th Lecture, Sept. 6, 2018 Today: Floating Point Background: Fractional binary numbers IEEE floating point
More informationIEEE Standard 754 Floating Point Numbers
IEEE Standard 754 Floating Point Numbers Steve Hollasch / Last update 2005-Feb-24 IEEE Standard 754 floating point is the most common representation today for real numbers on computers, including Intel-based
More informationRepresenting and Manipulating Floating Points. Jo, Heeseung
Representing and Manipulating Floating Points Jo, Heeseung The Problem How to represent fractional values with finite number of bits? 0.1 0.612 3.14159265358979323846264338327950288... 2 Fractional Binary
More informationFloating 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 informationFloating 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 informationUp next. Midterm. Today s lecture. To follow
Up next Midterm Next Friday in class Exams page on web site has info + practice problems Excited for you to rock the exams like you have been the assignments! Today s lecture Back to numbers, bits, data
More informationCS101 Introduction to computing Floating Point Numbers
CS101 Introduction to computing Floating Point Numbers A. Sahu and S. V.Rao Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati 1 Outline Need to floating point number Number representation
More informationFloating Point Considerations
Chapter 6 Floating Point Considerations In the early days of computing, floating point arithmetic capability was found only in mainframes and supercomputers. Although many microprocessors designed in the
More informationToday: Floating Point. Floating Point. Fractional Binary Numbers. Fractional binary numbers. bi bi 1 b2 b1 b0 b 1 b 2 b 3 b j
Floating Point 15 213: Introduction to Computer Systems 4 th Lecture, Jan 24, 2013 Instructors: Seth Copen Goldstein, Anthony Rowe, Greg Kesden 2 Fractional binary numbers What is 1011.101 2? Fractional
More informationComputer 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 informationCO212 Lecture 10: Arithmetic & Logical Unit
CO212 Lecture 10: Arithmetic & Logical Unit Shobhanjana Kalita, Dept. of CSE, Tezpur University Slides courtesy: Computer Architecture and Organization, 9 th Ed, W. Stallings Integer Representation For
More informationFoundations of Computer Systems
18-600 Foundations of Computer Systems Lecture 4: Floating Point Required Reading Assignment: Chapter 2 of CS:APP (3 rd edition) by Randy Bryant & Dave O Hallaron Assignments for This Week: Lab 1 18-600
More informationScientific 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 informationFloating Point. CSE 238/2038/2138: Systems Programming. Instructor: Fatma CORUT ERGİN. Slides adapted from Bryant & O Hallaron s slides
Floating Point CSE 238/2038/2138: Systems Programming Instructor: Fatma CORUT ERGİN Slides adapted from Bryant & O Hallaron s slides Today: Floating Point Background: Fractional binary numbers IEEE floating
More informationComputational 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 information15213 Recitation 2: Floating Point
15213 Recitation 2: Floating Point 1 Introduction This handout will introduce and test your knowledge of the floating point representation of real numbers, as defined by the IEEE standard. This information
More informationFloating-Point Arithmetic
ENEE446---Lectures-4/10-15/08 A. Yavuz Oruç Professor, UMD, College Park Copyright 2007 A. Yavuz Oruç. All rights reserved. Floating-Point Arithmetic Integer or fixed-point arithmetic provides a complete
More informationClasses 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 informationFloating-Point Arithmetic
Floating-Point Arithmetic Raymond J. Spiteri Lecture Notes for CMPT 898: Numerical Software University of Saskatchewan January 9, 2013 Objectives Floating-point numbers Floating-point arithmetic Analysis
More informationFloating 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 informationDivide: 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 informationINTEGER REPRESENTATIONS
INTEGER REPRESENTATIONS Unsigned Representation (B2U). Two s Complement (B2T). Signed Magnitude (B2S). Ones Complement (B2O). scheme size in bits (w) minimum value maximum value B2U 5 0 31 B2U 8 0 255
More informationIntroduction 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 informationCMPSCI 145 MIDTERM #2 Solution Key SPRING 2018 April 13, 2018 Professor William T. Verts
CMPSCI 145 MIDTERM #2 Solution Key SPRING 2018 April 13, 2018 10 Points Answer 10 of the following problems (1 point each). Answer more than 10 for extra credit. Scoring will be +1 for each correct
More informationCS321. Introduction to Numerical Methods
CS31 Introduction to Numerical Methods Lecture 1 Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 40506 0633 August 5, 017 Number
More informationChapter 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 informationNumber 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 informationCOMPUTER ORGANIZATION AND ARCHITECTURE
COMPUTER ORGANIZATION AND ARCHITECTURE For COMPUTER SCIENCE COMPUTER ORGANIZATION. SYLLABUS AND ARCHITECTURE Machine instructions and addressing modes, ALU and data-path, CPU control design, Memory interface,
More informationIntroduction to Computer Systems Recitation 2 May 29, Marjorie Carlson Aditya Gupta Shailin Desai
Introduction to Computer Systems Recitation 2 May 29, 2014 Marjorie Carlson Aditya Gupta Shailin Desai 1 Agenda! Goal: translate any real number (plus some!) into and out of machine representation.! Integers!
More informationUNIVERSITY 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-C Floating-Point Arithmetic - III Israel Koren ECE666/Koren Part.4c.1 Floating-Point Adders
More information3.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 informationBindel, Fall 2016 Matrix Computations (CS 6210) Notes for
1 Logistics Notes for 2016-09-07 1. We are still at 50. If you are still waiting and are not interested in knowing if a slot frees up, let me know. 2. There is a correction to HW 1, problem 4; the condition
More informationReview 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 informationFloating 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 informationFloating Point. CSE 351 Autumn Instructor: Justin Hsia
Floating Point CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun http://xkcd.com/899/
More informationThe course that gives CMU its Zip! Floating Point Arithmetic Feb 17, 2000
15-213 The course that gives CMU its Zip! Floating Point Arithmetic Feb 17, 2000 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties IA32 floating point Floating
More informationThe ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop.
CS 320 Ch 10 Computer Arithmetic The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop. Signed integers are typically represented in sign-magnitude
More informationFloating 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 informationEE878 Special Topics in VLSI. Computer Arithmetic for Digital Signal Processing
EE878 Special Topics in VLSI Computer Arithmetic for Digital Signal Processing Part 4-B Floating-Point Arithmetic - II Spring 2017 Koren Part.4b.1 The IEEE Floating-Point Standard Four formats for floating-point
More informationComputational 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 informationfractional 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 informationComputer Arithmetic Ch 8
Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) (aritmeettis-looginen yksikkö) Does all
More informationComputer Arithmetic Ch 8
Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) Does all work in CPU (aritmeettis-looginen
More informationComputing Basics. 1 Sources of Error LECTURE NOTES ECO 613/614 FALL 2007 KAREN A. KOPECKY
LECTURE NOTES ECO 613/614 FALL 2007 KAREN A. KOPECKY Computing Basics 1 Sources of Error Numerical solutions to problems differ from their analytical counterparts. Why? The reason for the difference is
More informationNumerical computing. How computers store real numbers and the problems that result
Numerical computing How computers store real numbers and the problems that result The scientific method Theory: Mathematical equations provide a description or model Experiment Inference from data Test
More informationUNIVERSITY 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-B Floating-Point Arithmetic - II Israel Koren ECE666/Koren Part.4b.1 The IEEE Floating-Point
More information