ECE 645: Lecture 5 Number Representation
|
|
- Beverly Dennis
- 6 years ago
- Views:
Transcription
1 ECE 645: Lecture 5 Number Representation Part 2 Little-Endian vs. Big-Endian Representations Floating Point Representations Rounding Representation of the Galois Field elements
2 Required Reading Endianness, from Wikipedia, the free encyclopedia Behrooz Parhami, Computer Arithmetic: Algorithms and Hardware Design Chapter 17, Floating-Point Representations
3 Little-Endian vs. Big-Endian Representation of Integers
4 Little-Endian vs. Big-Endian Representation A0 B1 C2 D3 E4 F MSB Big-Endian LSB Little-Endian MSB = A0 B1 C2 D3 E4 F5 67 LSB = 89 0 address MAX LSB = F5 E4 D3 C2 B1 MSB = A0
5 Little-Endian vs. Big-Endian Camps MSB... LSB Big-Endian 0 address MAX LSB... MSB Little-Endian Motorola 68xx, 680x0 IBM Hewlett-Packard Sun SuperSPARC Internet TCP/IP Bi-Endian Motorola Power PC Silicon Graphics MIPS Intel AMD DEC VAX RS 232
6 Little-Endian vs. Big-Endian Origin of the terms Jonathan Swift, Gulliver s Travels A law requiring all citizens of Lilliput to break their soft-eggs at the little ends only A civil war breaking between the Little Endians and the Big-Endians, resulting in the Big Endians taking refuge on a nearby island, the kingdom of Blefuscu Satire over holy wars between Protestant Church of England and the Catholic Church of France
7
8 Little-Endian vs. Big-Endian Advantages and Disadvantages Big-Endian easier to determine a sign of the number Little-Endian easier addition and multiplication of multiprecision numbers easier to compare two numbers easier to divide two numbers easier to print
9 Pointers (1) Big-Endian Little-Endian 0 address MAX F5 E4 D3 C2 B1 A0 int * iptr; (* iptr) = 8967; (* iptr) = 6789; iptr+1
10 Pointers (2) Big-Endian Little-Endian 0 address MAX F5 E4 D3 C2 B1 A0 long int * lptr; (* lptr) = 8967F5E4; (* lptr) = E4F56789; lptr + 1
11 Floating Point Representations
12
13
14
15
16 The ANSI/IEEE standard floatingpoint number representation formats Short (32-bit) format Originally IEEE Superseded by IEEE Standard. 8 bits, bias = 127, ñ126 to 127 Sign Exponent 23 bits for fractional part (plus hidden 1 in integer part) Significand 11 bits, bias = 1023, ñ1022 to bits for fractional part (plus hidden 1 in integer part) Long (64-bit) format
17
18
19 Table 17.1 Some features of the ANSI/IEEE standard floatingpoint number representation formats
20 Exponent Encoding Exponent encoding in 8 bits for the single/short (32-bit) ANSI/IEEE format Decimal code Hex code E 7F 80 FE FF Exponent value f 2 e f = 0: Representation of ±0 f 0: Representation of denormals, 0.f f = 0: Representation of ± f 0: Representation of NaNs
21 Fig Denormals in the IEEE single-precision format.
22
23
24
25 New IEEE Standard Basic Formats
26 New IEEE Standard Binary Interchange Formats
27 Requirements for Arithmetic Results of the 4 basic arithmetic operations (+, -,, ) as well as squarerooting must match those obtained if all intermediate computations were infinitely precise That is, a floating-point arithmetic operation should introduce no more imprecision than the error attributable to the final rounding of a result that has no exact representation (this is the best possible) Example: ( ) ( ) Exact result Rounded result Error = ½ ulp
28 Rounding 101
29 Rounding Modes The IEEE standard includes five rounding modes: Default: Round to nearest, ties to even (rtne) Optional: Round to nearest, ties away from 0 (rtna) Round toward zero (inward) Round toward + Round toward (upward) (downward)
30 Required Reading Parhami, Chapter 17.5, Rounding schemes Rounding Algorithms
31 Rounding Rounding occurs when we want to approximate a more precise number (i.e. more fractional bits L) with a less precise number (i.e. fewer fractional bits L') Example 1: old: (K=6, L=8) new: (K'=6, L'=2) Example 2: old: (K=6, L=8) new: (K'=6, L'=0) The following pages show rounding from L>0 fractional bits to L'=0 bits, but the mathematics hold true for any L' < L Usually, keep the number of integral bits the same K'=K 31
32 Rounding Equation Whole part Fractional part x k 1 x k 2... x 1 x 0. x 1 x 2... x Round l y k 1 y k 2... y 1 y 0 y = round(x) 32
33 Rounding Techniques There are different rounding techniques: 1) truncation results in round towards zero in signed magnitude results in round towards - in two's complement 2) round to nearest number 3) round to nearest even number (or odd number) 4) round towards + Other rounding techniques 5) jamming or von Neumann 6) ROM rounding Each of these techniques will differ in their error depending on representation of numbers i.e. signed magnitude versus two's complement Error = round(x) x 33
34 1) Truncation The simplest possible rounding scheme: chopping or truncation x k 1 x k 2... x 1 x 0. x 1 x 2... x trunc l x k 1 x k 2... x 1 x 0 ulp Truncation in signed-magnitude results in a number chop(x) that is always of smaller magnitude than x. This is called round towards zero or inward rounding (3.5) 10 à 011 (3) 10 Error = (-3.5) 10 à 111 (-3) 10 Error = +0.5 Truncation in two's complement results in a number chop(x) that is always smaller than x. This is called round towards - or downward-directed rounding (3.5) 10 à 011 (3) 10 Error = (-3.5) 10 à 100 (-4) 10 Error =
35 Truncation Function Graph: chop(x) chop( x ) Fig Truncation or chopping of a signed-magnitude number (same as round toward 0). x chop( x ) Fig Truncation or chopping of a 2 s-complement number (same as round to - ). x 35
36 Bias in two's complement truncation X (binary) X (decimal) chop(x) (binary) chop(x) (decimal) Error (decimal) Assuming all combinations of positive and negative values of x equally possible, average error is In general, average error = -(2 -L' -2 -L )/2, where L' = new number of fractional bits 36
37 Implementation truncation in hardware Easy, just ignore (i.e. truncate) the fractional digits from L to L'+1 x k-1 x k-2.. x 1 x 0. x -1 x -2.. x -L = y k-1 y k-2.. y 1 y 0. ignore (i.e. truncate the rest) 37
38 2) Round to nearest number Rounding to nearest number what we normally think of when say round (2.25) 10 à 010 (2) 10 Error = (2.75) 10 à 011 (3) 10 Error = (2.00) 10 à 010 (2) 10 Error = (2.5) 10 à 011 (3) 10 Error = +0.5 [round-half-up (arithmetic rounding)] (2.5) 10 à 010 (2) 10 Error = -0.5 [round-half-down] 38
39 Round-half-up: dealing with negative numbers Rounding to nearest number what we normally think of when say round (-2.25) 10 à 110 (-2) 10 Error = (-2.75) 10 à 101 (-3) 10 Error = (-2.00) 10 à 110 (-2) 10 Error = (-2.5) 10 à 110 (-2) 10 Error = +0.5 [asymmetric implementation] (-2.5) 10 à 101 (-3) 10 Error = -0.5 [symmetric implementation] 39
40 Round to Nearest Function Graph: rtn(x) Round-half-up version Asymmetric implementation Symmetric implementation rtn(x) ñ4 ñ3 ñ2 ñ ñ1 ñ2 ñ3 ñ4 x rtn(x) ñ4 ñ3 ñ2 ñ ñ1 ñ2 ñ3 ñ4 x 40
41 Bias in two's complement round to nearest Round-half-up asymmetric implementation X (binary) X (decimal) rtn(x) (binary) rtn(x) (decimal) Error (decimal) Assuming all combinations of positive and negative values of x equally possible, average error is Smaller average error than truncation, but still not symmetric error We have a problem with the midway value, i.e. exactly at 2.5 or -2.5 leads to positive error bias always Also have the problem that you can get overflow if only allocate K' = K integral bits Example: rtn(011.10) à overflow This overflow only occurs on positive numbers near the maximum positive value, not on negative numbers 41
42 Implementing round to nearest (rtn) in hardware Round-half-up asymmetric implementation Two methods Method 1: Add '1' in position one digit right of new LSB (i.e. digit L'+1) and keep only L' fractional bits x k-1 x k-2.. x 1 x 0. x -1 x -2.. x -L + 1 = y k-1 y k-2.. y 1 y 0. y -1 Method 2: Add the value of the digit one position to right of new LSB (i.e. digit L'+1) into the new LSB digit (i.e. digit L) and keep only L' fractional bits x k-1 x k-2.. x 1 x 0. x -1 x -2.. x -L + x -1 y k-1 y k-2.. y 1 y 0. ignore (i.e. truncate the rest) ignore (i.e truncate the rest) 42
43 Round to Nearest Even Function Graph: rtne(x) To solve the problem with the midway value we implement round to nearest-even number (or can round to nearest odd number) rtne(x) R*(x) ñ4 ñ3 ñ2 ñ ñ1 ñ2 ñ3 ñ4 Fig Rounding to the nearest even number x ñ4 ñ3 ñ2 ñ ñ1 ñ2 ñ3 ñ4 Fig R* rounding or rounding to the nearest odd number. x 43
44 Bias in two's complement round to nearest even (rtne) X (binary) X (decimal ) rtne(x) (binary) rtne(x) (decimal) Error (decimal) (overfl) average error is now 0 (ignoring the overflow) cost: more hardware 44
45 4) Rounding towards infinity We may need computation errors to be in a known direction Example: in computing upper bounds, larger results are acceptable, but results that are smaller than correct values could invalidate upper bound Use upward-directed rounding (round toward + ) up(x) always larger than or equal to x Similarly for lower bounds, use downward-directed rounding (round toward - ) down(x) always smaller than or equal to x We have already seen that round toward - in two's complement can be implemented by truncation 45
46 Rounding Toward Infinity Function Graph: up(x) and down(x) up(x) down(x) down(x) can be implemented by chop(x) in two's complement 46
47 Two's Complement Round to Zero Two's complement round to zero (inward rounding) also exists inward( x ) x 47
48 Other Methods Note that in two's complement round to nearest (rtn) involves an addition which may have a carry propagation from LSB to MSB Rounding may take as long as an adder takes Can break the adder chain using the following two techniques: Jamming or von Neumann ROM-based 48
49 5) Jamming or von Neumann jam(x) ñ4 ñ3 ñ2 ñ ñ1 ñ2 ñ3 x Chop and force the LSB of the result to 1 Simplicity of chopping, with the near-symmetry or ordinary rounding Max error is comparable to chopping (double that of rounding) ñ4 49
50 6) ROM Rounding ROM(x) ñ4 ñ3 ñ2 ñ ñ1 ñ2 ñ3 ñ4 x Fig ROM rounding with an 8 2 table. Example: Rounding with a 32 4 table Rounding result is the same as that of the round to nearest scheme in 31 of the 32 possible cases, but a larger error is introduced when x 3 = x 2 = x 1 = x 0 = x 1 = 1 x k 1... x 4 x 3 x 2 x 1 x 0. x 1 x 2... x l ROM x k 1... x 4 y 3 y 2 y 1 y 0 ROM address ROM data 50
51 Representation of the Galois Field elements
52 Evariste Galois ( )
53 Evariste Galois ( ) Studied the problem of finding algebraic solutions for the general equations of the degree 5, e.g., f(x) = a 5 x 5 + a 4 x 4 + a 3 x 3 + a 2 x 2 + a 1 x+ a 0 = 0 Answered definitely the question which specific equations of a given degree have algebraic solutions. On the way, he developed group theory, one of the most important branches of modern mathematics.
54 Evariste Galois ( ) 1829 Galois submits his results for the first time to the French Academy of Sciences Reviewer 1 Augustin-Luis Cauchy forgot or lost the communication Galois submits the revised version of his manuscript, hoping to enter the competition for the Grand Prize in mathematics Reviewer 2 Joseph Fourier died shortly after receiving the manuscript Third submission to the French Academy of Sciences Reviewer 3 Simeon-Denis Poisson did not understand the manuscript and rejected it.
55 Evariste Galois ( ) May 1832 Galois provoked into a duel The night before the duel he wrote a letter to his friend containing the summary of his discoveries. The letter ended with a plea: Eventually there will be, I hope, some people who will find it profitable to decipher this mess. May 30, 1832 Galois was grievously wounded in the duel and died in the hospital the following day Galois manuscript rediscovered by Joseph Liouville 1846 Galois manuscript published for the first time in a mathematical journal.
56
57 Field Set F, and two operations typically denoted by (but not necessarily equivalent to) + and * Set F, and definitions of these two operations must fulfill special conditions.
58 Infinite fields Finite fields Examples of fields { R= set of real numbers, + addition of real numbers * multiplication of real numbers } { set Zp={0, 1, 2,, p-1}, + (mod p): addition modulo p, * (mod p): multiplication modulo p }
59 Finite Fields = Galois Fields GF(p m ) p prime p m number of elements in the field Arithmetic operations present in many libraries GF(p) GF(2 m ) Polynomial basis representation Most significant special cases Normal basis representation Fast in hardware Fast squaring
60 Quotient and remainder Given integers a and n, n>0! q, r Z such that a = q n + r and 0 r < n q quotient r remainder (of a divided by n) q = a n = a div n r = a - q n = a = a mod n a n n =
61 32 mod 5 = -32 mod 5 =
62 Integers coungruent modulo n Two integers a and b are congruent modulo n (equivalent modulo n) written a b iff a mod n = b mod n or a = b + kn, k Z or n a - b
63 Laws of modular arithmetic
64 Rules of addition, subtraction and multiplication modulo n a + b mod n = ((a mod n) + (b mod n)) mod n a - b mod n = ((a mod n) - (b mod n)) mod n a b mod n = ((a mod n) (b mod n)) mod n
65 9 13 mod 5 = mod 26 =
66 Laws of modular arithmetic Regular addition a+b = a+c iff b=c Regular multiplication If a b = a c and a 0 then b = c Modular addition a+b a+c (mod n) iff b c (mod n) Modular multiplication If a b a c (mod n) and gcd (a, n) = 1 then b c (mod n)
67 Modular Multiplication: Example (mod 8) (mod 8) 3 7 (mod 8) x 6 x mod x 5 x mod
68 Finite Fields = Galois Fields GF(p m ) p prime p m number of elements in the field Arithmetic operations present in many libraries GF(p) GF(2 m ) Polynomial basis representation Most significant special cases Normal basis representation Fast in hardware Fast squaring
69 Elements of the Galois Field GF(2 m ) Binary representation (used for storing and processing in computer systems): A = (a m-1, a m-2,, a 2, a 1, a 0 ) a i {0, 1} Polynomial representation (used for the definition of basic arithmetic operations): m-1 A(x) = a i x i = a m-1 x m-1 + a m-2 x m a 2 x 2 + a 1 x+a 0 i=0 multiplication + addition modulo 2 (XOR)
70 Addition and Multiplication in the Galois Field GF(2 m ) Inputs A = (a m-1, a m-2,, a 2, a 1, a 0 ) B = (b m-1, b m-2,, b 2, b 1, b 0 ) a i, b i {0, 1} Output C = (c m-1, c m-2,, c 2, c 1, c 0 ) c i {0, 1}
71 Addition Addition in the Galois Field GF(2 m ) A A(x) B B(x) C C(x) = A(x) + B(x) = = (a m-1 +b m-1 ) x m-1 + (a m-2 +b m-2 ) x m (a 2 +b 2 ) x 2 + (a 1 +b 1 ) x + (a 0 +b 0 ) = = c m-1 x m-1 + c m-2 x m c 2 x 2 + c 1 x+c 0 multiplication + addition modulo 2 (XOR) c i = a i + b i = a i XOR b i C = A XOR B
72 Multiplication in the Galois Field GF(2 m ) Multiplication A A(x) B B(x) C C(x) = A(x) B(x) mod P(X) = c m-1 x m-1 + c m-2 x m c 2 x 2 + c 1 x+c 0 P(x) - irreducible polynomial of the degree m P(x) = p m x m + p m-1 x m p 2 x 2 + p 1 x+p 0
73
Number Representation
ECE 645: Lecture 5 Number Representation Part 2 Floating Point Representations Rounding Representation of the Galois Field elements Required Reading Behrooz Parhami, Computer Arithmetic: Algorithms and
More informationLecture 3: Basic Adders and Counters
Lecture 3: Basic Adders and Counters ECE 645 Computer Arithmetic /5/8 ECE 645 Computer Arithmetic Lecture Roadmap Revisiting Addition and Overflow Rounding Techniques Basic Adders and Counters Required
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 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 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 informationComputer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK
Computer (Literacy Skills Number representations and memory Lubomír Bulej KDSS MFF UK Number representations? What for? Recall: computer works with binary numbers Groups of zeroes and ones 8 bits (byte,
More informationPart V Real Arithmetic
Part V Real Arithmetic Parts Chapters I. Number Representation 1. 2. 3. 4. Numbers and Arithmetic Representing Signed Numbers Redundant Number Systems Residue Number Systems Elementary Operations II. III.
More informationCS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.
CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. 1 Part 1: Data Representation Our goal: revisit and re-establish fundamental of mathematics for the computer architecture course Overview: what are bits
More informationPart V Real Arithmetic
Part V Real Arithmetic Parts Chapters I. Number Representation 1. 2. 3. 4. Numbers and Arithmetic Representing Signed Numbers Redundant Number Systems Residue Number Systems Elementary Operations II. III.
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 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 informationInf2C - Computer Systems Lecture 2 Data Representation
Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack
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 informationECE331: Hardware Organization and Design
ECE331: Hardware Organization and Design Lecture 15: Midterm 1 Review Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Basics Midterm to cover Book Sections (inclusive) 1.1 1.5
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 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 informationComputer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers
Computer Science 324 Computer Architecture Mount Holyoke College Fall 2007 Topic Notes: Bits and Bytes and Numbers Number Systems Much of this is review, given the 221 prerequisite Question: how high can
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 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 informationM1 Computers and Data
M1 Computers and Data Module Outline Architecture vs. Organization. Computer system and its submodules. Concept of frequency. Processor performance equation. Representation of information characters, signed
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 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 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 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 informationRepresenting numbers on the computer. Computer memory/processors consist of items that exist in one of two possible states (binary states).
Representing numbers on the computer. Computer memory/processors consist of items that exist in one of two possible states (binary states). These states are usually labeled 0 and 1. Each item in memory
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 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 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 informationCS 6210 Fall 2016 Bei Wang. Lecture 4 Floating Point Systems Continued
CS 6210 Fall 2016 Bei Wang Lecture 4 Floating Point Systems Continued Take home message 1. Floating point rounding 2. Rounding unit 3. 64 bit word: double precision (IEEE standard word) 4. Exact rounding
More informationMACHINE 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 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 informationFloating-Point Arithmetic
Floating-Point Arithmetic if ((A + A) - A == A) { SelfDestruct() } Reading: Study Chapter 4. L12 Multiplication 1 Why Floating Point? Aren t Integers enough? Many applications require numbers with a VERY
More informationBy, Ajinkya Karande Adarsh Yoga
By, Ajinkya Karande Adarsh Yoga Introduction Early computer designers believed saving computer time and memory were more important than programmer time. Bug in the divide algorithm used in Intel chips.
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
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 informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
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 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 informationNumber Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:
N Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: a n a a a The value of this number is given by: = a n Ka a a a a a
More informationNumber 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 informationPart III The Arithmetic/Logic Unit. Oct Computer Architecture, The Arithmetic/Logic Unit Slide 1
Part III The Arithmetic/Logic Unit Oct. 214 Computer Architecture, The Arithmetic/Logic Unit Slide 1 About This Presentation This presentation is intended to support the use of the textbook Computer Architecture:
More informationWritten Homework 3. Floating-Point Example (1/2)
Written Homework 3 Assigned on Tuesday, Feb 19 Due Time: 11:59pm, Feb 26 on Tuesday Problems: 3.22, 3.23, 3.24, 3.41, 3.43 Note: You have 1 week to work on homework 3. 3 Floating-Point Example (1/2) Q:
More informationIEEE-754 floating-point
IEEE-754 floating-point Real and floating-point numbers Real numbers R form a continuum - Rational numbers are a subset of the reals - Some numbers are irrational, e.g. π Floating-point numbers are an
More informationFloating-point numbers. Phys 420/580 Lecture 6
Floating-point numbers Phys 420/580 Lecture 6 Random walk CA Activate a single cell at site i = 0 For all subsequent times steps, let the active site wander to i := i ± 1 with equal probability Random
More informationNumber Representations
Number Representations times XVII LIX CLXX -XVII D(CCL)LL DCCC LLLL X-X X-VII = DCCC CC III = MIII X-VII = VIIIII-VII = III 1/25/02 Memory Organization Viewed as a large, single-dimension array, with an
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. 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 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 informationComputer Architecture Chapter 3. Fall 2005 Department of Computer Science Kent State University
Computer Architecture Chapter 3 Fall 2005 Department of Computer Science Kent State University Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point
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 informationFinite 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 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 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 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 informationAccuracy 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 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 informationReview: MIPS Organization
1 MIPS Arithmetic Review: MIPS Organization Processor Memory src1 addr 5 src2 addr 5 dst addr 5 write data Register File registers ($zero - $ra) bits src1 data src2 data read/write addr 1 1100 2 30 words
More informationAt the ith stage: Input: ci is the carry-in Output: si is the sum ci+1 carry-out to (i+1)st state
Chapter 4 xi yi Carry in ci Sum s i Carry out c i+ At the ith stage: Input: ci is the carry-in Output: si is the sum ci+ carry-out to (i+)st state si = xi yi ci + xi yi ci + xi yi ci + xi yi ci = x i yi
More informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2010 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review, but we will go over it for
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 informationMIPS Integer ALU Requirements
MIPS Integer ALU Requirements Add, AddU, Sub, SubU, AddI, AddIU: 2 s complement adder/sub with overflow detection. And, Or, Andi, Ori, Xor, Xori, Nor: Logical AND, logical OR, XOR, nor. SLTI, SLTIU (set
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 informationCPE300: Digital System Architecture and Design
CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Arithmetic Unit 10122011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Recap Fixed Point Arithmetic Addition/Subtraction
More informationH5H4, H5E7 lecture 5 Fixed point arithmetic. Overview
H5H4, H5E7 lecture 5 Fixed point arithmetic I. Verbauwhede Acknowledgements: H. DeMan, V. Öwall, D. Hwang, 007-008 K.U.Leuven 1 Overview Lecture 1: what is a system-on-chip Lecture : terminology for the
More informationFloating-Point Arithmetic
Floating-Point Arithmetic if ((A + A) - A == A) { SelfDestruct() } Reading: Study Chapter 3. L12 Multiplication 1 Approximating Real Numbers on Computers Thus far, we ve entirely ignored one of the most
More informationFloating-Point Arithmetic
Floating-Point Arithmetic if ((A + A) - A == A) { SelfDestruct() } L11 Floating Point 1 What is the problem? Many numeric applications require numbers over a VERY large range. (e.g. nanoseconds to centuries)
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-A Floating-Point Arithmetic Israel Koren ECE666/Koren Part.4a.1 Preliminaries - Representation
More informationComputer arithmetics: integers, binary floating-point, and decimal floating-point
n!= 0 && -n == n z+1 == z Computer arithmetics: integers, binary floating-point, and decimal floating-point v+w-w!= v x+1 < x Peter Sestoft 2010-02-16 y!= y p == n && 1/p!= 1/n 1 Computer arithmetics Computer
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 informationECE331: Hardware Organization and Design
ECE331: Hardware Organization and Design Lecture 10: Multiplication & Floating Point Representation Adapted from Computer Organization and Design, Patterson & Hennessy, UCB MIPS Division Two 32-bit registers
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 informationIntroduction to the new AES Standard: Rijndael
Introduction to the new AES Standard: Rijndael Paul Donis This paper will explain how the Rijndael Cipher Reference Code in C works. Rijndael is a block cipher that encrypts and decrypts 128, 192, and
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 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 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 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 informationCMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012
CMSC 33 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 2, FALL 22 TOPICS TODAY Bits of Memory Data formats for negative numbers Modulo arithmetic & two s complement Floating point formats
More informationCOMP 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 informationNumber 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 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 informationComputer Architecture. Chapter 3: Arithmetic for Computers
182.092 Computer Architecture Chapter 3: Arithmetic for Computers Adapted from Computer Organization and Design, 4 th Edition, Patterson & Hennessy, 2008, Morgan Kaufmann Publishers and Mary Jane Irwin
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. 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 informationl l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers
198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book Computer Architecture What do computers do? Manipulate stored information
More informationArithmetic for Computers. Hwansoo Han
Arithmetic for Computers Hwansoo Han Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation
More informationARM. Assembly Language and Machine Code. Goal: Blink an LED
ARM Assembly Language and Machine Code Goal: Blink an LED Review Turning on an LED Connect LED to GPIO 20 3.3V 1k GND 1 -> 3.3V 0 -> 0.0V (GND) Two Steps 1. Configure GPIO20 to be an OUTPUT 2. "Set" GPIO20
More informationEE 109 Unit 19. IEEE 754 Floating Point Representation Floating Point Arithmetic
1 EE 109 Unit 19 IEEE 754 Floating Point Representation Floating Point Arithmetic 2 Floating Point Used to represent very small numbers (fractions) and very large numbers Avogadro s Number: +6.0247 * 10
More information±M R ±E, S M CHARACTERISTIC MANTISSA 1 k j
ENEE 350 c C. B. Silio, Jan., 2010 FLOATING POINT REPRESENTATIONS It is assumed that the student is familiar with the discussion in Appendix B of the text by A. Tanenbaum, Structured Computer Organization,
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 informationEC 413 Computer Organization
EC 413 Computer Organization Review I Prof. Michel A. Kinsy Computing: The Art of Abstraction Application Algorithm Programming Language Operating System/Virtual Machine Instruction Set Architecture (ISA)
More informationFloating Point COE 308. Computer Architecture Prof. Muhamed Mudawar. Computer Engineering Department King Fahd University of Petroleum and Minerals
Floating Point COE 38 Computer Architecture Prof. Muhamed Mudawar Computer Engineering Department King Fahd University of Petroleum and Minerals Presentation Outline Floating-Point Numbers IEEE 754 Floating-Point
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 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 informationFloating Point. CSE 351 Autumn Instructor: Justin Hsia
Floating Point CSE 351 Autumn 2017 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan Administrivia Lab
More informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2011 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review for most of you, but we start
More informationARM. Assembly Language and Machine Code. Goal: Blink an LED
ARM Assembly Language and Machine Code Goal: Blink an LED Memory Map 100000000 16 4 GB Peripheral registers are mapped into address space Memory-Mapped IO (MMIO) MMIO space is above physical memory 020000000
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 informationCMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes
Multiple-byte data CMSC 313 Lecture 03 big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes UMBC, CMSC313, Richard Chang 4-5 Chapter
More information