Efficient Search for Inputs Causing High Floating-point Errors

Size: px
Start display at page:

Download "Efficient Search for Inputs Causing High Floating-point Errors"

Transcription

1 Efficient Search for Inputs Causing High Floating-point Errors Wei-Fan Chiang, Ganesh Gopalakrishnan, Zvonimir Rakamarić, and Alexey Solovyev University of Utah Presented by Yuting Chen February 22, 2015

2 BACKGROUND: WHY DO WE HAVE FLOATING-POINT ERRORS Slides are from Computer Arithmetic: Algorithms and Hardware Designs by Behrooz Parhami

3 The IEEE Floating-Point Standard Short (32-bit) format IEEE Standard (supersedes IEEE ) 8 bits, bias = 127, 126 to 127 Sign Exponent 23 bits for fractional part (plus hidden 1 in integer part) Significand Also includes half- & quad-word binary, plus some decimal formats 11 bits, bias = 1023, 1022 to bits for fractional part (plus hidden 1 in integer part) Long (64-bit) format

4 Floating-Point Number Distribution Negative numbers Positive numbers max FLP min min + FLP max Sparser Denser Denser Sparser Overflow region Underflow regions Overflow region Midway example Underflow example Typical example Overflow example

5 Sources of Computational Errors FLP approximates exact computation with real numbers Two sources of errors to understand and counteract: Representation errors e.g., no machine representation for 1/3, 2, or p Arithmetic errors e.g., ( ) 2 = not representable in IEEE 754 short format

6 Example Showing Representation and Arithmetic Errors Compute 1/99 1/100, using a decimal floating-point format with 4-digit significand in [1, 10) and single-digit signed exponent Precise result = 1/ (error 10 8 or 0.01%) Chopped to 3 decimals x = 1/ Error 10 6 or 0.01% y = 1/100 = Error = 0 z = x fp y = = Error 10 6 or 1%

7 Forward Error Analysis Consider the computation y = ax + b and its floating-point version y fp = (a fp fp x fp ) + fp b fp = (1 + h)y Can we establish any useful bound on the magnitude of the relative error h, given the relative errors in the input operands a fp, b fp, x fp? The answer is no Forward error analysis = Finding out how far y fp can be from ax + b, or at least from a fp x fp + b fp, in the worst case

8 Backward Error Analysis Backward error analysis replaces the original question How much does y fp = a fp fp x fp + b fp deviate from y? with another question: What input changes produce the same deviation? In other words, if the exact identity y fp = a alt x alt + b alt holds for alternate parameter values a alt, b alt, and x alt, we ask how far a alt, b alt, x alt can be from a fp, x fp, x fp Thus, computation errors are converted or compared to additional input errors

9 Efficient Search for Inputs Causing High Floating-point Errors Wei-Fan Chiang, Ganesh Gopalakrishnan, Zvonimir Rakamarić, and Alexey Solovyev School of Computing, University of Utah, Salt Lake City, UT Supported in part by NSF grants ACI , CCF , CCF and CCF

10 Floating-point Computations in Sequential and Parallel Software Important applications such as weather prediction are accuracy-critical Everyday applications (e.g. cell-phone apps) run at lower FP precision Challenge : Knowing whether they give imprecise results for any input Photo courtesy to drroyspencer.com, aptito.com/blog, and itunes.apple.com. 1

11 Dangers of Inadequate or Inconsistent Precision Patriot Missile Failure in Miscalculated distance due to floating-point error. Inconsistent FP Calculations [Meng et al, XSEDE 13] P = C = Compute: floor( P / C ) Xeon Expecting 161 msgs Sent 162 msgs Xeon Phi P / C = floor( P / C ) = 161 P / C = 162 floor( P / C ) = 162 2

12 Problem Addressed How to tell which inputs maximize error? This is important for many reasons: Characterize libraries precisely Support tuning precision Help decide where error-compensation is productive Relative Error Feasible Inputs 3

13 Difficulties Large code-sizes Presence of non-linear operators Presence of data-dependent conditionals Concurrency (schedules may affect results) Relative Error Feasible Inputs 4

14 Main Contribution A practical technique for reliable precision estimation for sequential and parallel programs. Search based input generation. Handles diverse operations. Improves scalability. Usage scenarios: Precision bottleneck detection. Auto-tuning. 5

15 Previous Work Over-approximation based (false alarms likely) : Interval arithmetic: Examples x in [-1, 2] and y in [2, 5]. Then (x * y) returned as [-5, 10]. x in [-1, 1]. Then (x x) returned as [-2, 2] (must be 0) Affine arithmetic: Basic idea SMT Each number is represented by a polynomial. Linear approximation of non-linear operation. Encodes error bound described in IEEE-754 standard. Under-approximation based (no false alarms): Random testing. 6

16 Illustration of Interval Arithmetic 1. float x0, x1, x2 in [1.0, 2.0] 2. float p0 = (x0 + x1) x2 3. float p1 = (x1 + x2) x0 4. float p2 = (x2 + x0) x1 5. float sum = (p0 + p1) + p2 6. Error? sum // (x0 + x1) + x2 Value of sum Error on sum Exact Interval Arithmetic (Gappa) Affine Arithmetic (SmartFloat) SMT based [3.0, 6.0] [0.0, 9.0] [3.0, 6.0] [3.0, 6.0]? Infinite e e-15 7

17 Illustration of Affine Arithmetic / SMT 1. float xi in [1.0, 3.0] // 0 i 7 2. float sum = summation of xi 3. Consider xi in [1.0, 2.0] 4. Error? sum Value of sum Error on sum Exact Interval Arithmetic (Gappa) Affine Arithmetic (SmartFloat) SMT based [8.0, 16.0] [8.0, 16.0] N/A [8.0, 16.0]? e-16 N/A Timeout 8

18 Over-approximation: Previous Work Poor scalability Overly pessimistic results Limited support for non-linear operation Limited support for conditionals Interval Arithmetic Affine Arithmetic SMT based Our overall approach: Under-approximation based Naïve Random Testing produces VERY LOOSE lower bounds Our focus : How to produce tight lower-bounds? 9

19 Why do we base our approach on Guided Random Testing? Seems to be the only approach that can handle Large Programs Non-linear operators Data dependent conditionals No closed form solutions are possible At present, designers have no tools that can analyze programs with these features Ours is the first practical tool in this area 10

20 Precision Measurement by Random Testing Low Precision Program Low Precision Result configuration X0 X1 X2 Error Calculation* High Precision Program High Precision Result * Error = Relative Error (See paper for details) 11

21 Search Based Random Testing Our Contribution : Random Testing with Good Guidance Heuristics can Outperform Naïve Random We propose Binary Guided Random Testing 0 Pure Random Search Based Random Real Max. Error? Over-approximation 12

22 Search Based Random Testing Randomly sample inputs around sour-spots! A sour-spot causes highly imprecise program output. Definition of Configuration: An assignment from input variables to their probing intervals. Configuration: X X X2 Program Result 13

23 Search Based Random Testing Randomly sample inputs around sour-spots! A sour-spot causes highly imprecise program output. Definition of Configuration: An assignment from input variables to their probing intervals. Configuration: X X X2 X0 = 0.5 X1 = 1.5 X2 = 3.0 Program Imprecise Result 14

24 Search Based Random Testing Randomly sample inputs around sour-spots! A sour-spot causes highly imprecise program output. Definition of Configuration: An assignment from input variables to their probing intervals. New Configuration: X X X2 Program Result for New Config. 15

25 Importance of Selecting Good Configurations Good Conf. x0 x1 Original Conf. x0 x1 Bad Conf. x0 x1 Number of Samples 16

26 Binary Guided Random Testing: Search and Test Around Sour-spots Key Observations: Sour spots can be improved with more probing Configurations can be ranked without too much probing The optimization problem: Find a configuration that contains inputs causing high floating-point errors. We propose Binary Guided Random Testing (BGRT). We compared BGRT against other search methods, obtaining encouraging results 17

27 Original Conf. Init High-level View of BGRT Derive Configuration to Generate Candidates sub-... subconf. 1 conf. n Candidates Program 18

28 Original Conf. Init High-level View of BGRT Derive Configuration to Generate Candidates sub-... subconf. 1 conf. n Candidates Choose the BEST Sub-conf. Evaluate Program 19

29 Original Conf. Init High-level View of BGRT Derive Configuration to Generate Candidates sub-... subconf. 1 conf. n Candidates For each sub-conf., sample few inputs. Also Record the detected highest error. Choose the BEST Sub-conf. Evaluate Program 20

30 High-level View of BGRT Original Conf. Init Derive Configuration to Generate Candidates sub-conf. k The BEST among candidates sub-... subconf. 1 conf. n Candidates Choose the BEST Sub-conf. Evaluate Program For each sub-conf., sample few inputs. 21 Also Record the detected highest error.

31 High-level View of BGRT Original Conf. Init Derive Configuration to Generate Candidates Restart? sub-conf. k The BEST among candidates sub-... subconf. 1 conf. n Candidates Choose the BEST Sub-conf. Evaluate Program For each sub-conf., sample few inputs. 22 Also Record the detected highest error.

32 High-level View of BGRT Original Conf. Init Derive Configuration to Generate Candidates Restart? OR sub-conf. k The BEST among candidates sub-... subconf. 1 conf. n Candidates Choose the BEST Sub-conf. Evaluate Program For each sub-conf., sample few inputs. 23 Also Record the detected highest error.

33 X1 A Closer View of BGRT X0 X1 X2 X0 X2 Partition the variables (with their ranges). 24

34 A Closer View of BGRT X0 X1 X2 X1 X0 X2 X1 X1 Shrink variables ranges. X0 X2 X0 X2 Each partition generates its upper and lower subpartitions. 25

35 A Closer View of BGRT X0 X1 X2 X1 X0 X2 X1 X1 X0 X2 X0 X2 X0 X1 X2 X0 X1 X2 X0 X1 X2 X0 X1 X2 26

36 A Closer View of BGRT X0 X1 X2 Candidates These candidates are evaluated using random sampled inputs. X0 X1 X2 X0 X1 X2 X0 X1 X2 X0 X1 X2 27

37 Other Search Strategies We Investigated Iterated Local Search (ILS) Particle Swarm Optimization (PSO) Our results suggest BGRT as the better search strategy for precision measurement. Focuses the search near sour-spots. Website for additional documents: 28

38 Experimental Results Comparison among search strategies Unguided Random Testing (URT), BGRT, ILS, and PSO Benchmarks Various reduction-tree shapes Direct Quadrature Method of Moments (DQMOM) GPU primitives 29

39 Evaluation of BGRT (Reductions) Imbalanced reduction (IBR) Balanced reduction (BR) Compensated imbalanced reduction (IBRK) Over-approximation techniques cannot report that the compensated reduction is the most precise. Balanced Reduction ((v0 + v1) + (v2 + v3)) Imbalanced Reduction (((v0 + v1) + v2) + v3) (v0 + v1) (v2 + v3) ((v0 + v1) + v2) v3 v0 v1 v2 v3 (v0 + v1) v2 v0 v1 30

40 Evaluation of BGRT (Reductions) 2048 input variables Exp1 and Exp2 share all the same experiment settings except the seed for random number generation. 31

41 A Real-world Sequential Benchmark Direct Quadrature Method of Moments (DQMOM): A sequential core function of a combustion simulation component of Uintah parallel computational framework. (960 variables) 32

42 Evaluation of BGRT (GPU Primitives) Fast Fourier Transform (FFT) from Parboil LU decomposition from MAGMA library QR decomposition from MAGMA library Matrix multiplication (MM) from MAGMA library 33

43 Evaluation of BGRT (GPU Primitives) Input size: FFT: LU, QR: MM:

44 Challenges and Future Work Improvements: Coverage Scalability Search strategy improvement Applications: Combine with auto-tuning Combine with precision bottleneck detection Algorithm comparison 35

45 Conclusions Guided random testing can detect higher errors than pure random testing. Guided random testing overcomes some drawbacks of previous approaches: Improves scalability Handles diverse (e.g. non-linear) operations Supports precision bottleneck detection and auto-tuning Our project website 36

46 A Comparison Among BGRT, Genetic Algorithm, and Delta Debugging BGRT v.s. Genetic algorithm BGRT doesn t have mutation. BGRT only selects one of the best among current candidates to generate next candidates. BGRT v.s. Delta debugging BGRT could restart the search from the initial conf. Each conf. represents a set of inputs instead of a single input. 38

Efficient Search for Inputs Causing High Floating-point Errors

Efficient Search for Inputs Causing High Floating-point Errors Efficient Search for Inputs Causing High Floating-point Errors Wei-Fan Chiang, Ganesh Gopalakrishnan, Zvonimir Rakamarić, and Alexey Solovyev School of Computing, University of Utah, Salt Lake City, UT

More information

Efficient Search for Inputs Causing High Floating-point Errors

Efficient Search for Inputs Causing High Floating-point Errors Efficient Search for Inputs Causing High Floating-point Errors Wei-Fan Chiang Ganesh Gopalakrishnan Zvonimir Rakamarić Alexey Solovyev School of Computing, University of Utah, Salt Lake City, UT 84112,

More information

ANALYSIS AND SYNTHESIS OF FLOATING-POINT ROUTINES. Zvonimir Rakamarić

ANALYSIS AND SYNTHESIS OF FLOATING-POINT ROUTINES. Zvonimir Rakamarić ANALYSIS AND SYNTHESIS OF FLOATING-POINT ROUTINES Zvonimir Rakamarić ROADMAP 1. Introduction 2. Floating-point Research at Utah 3. Floating-points in SMACK Verifier 4. Floating-point Error Analysis 5.

More information

Floating-point Precision vs Performance Trade-offs

Floating-point Precision vs Performance Trade-offs Floating-point Precision vs Performance Trade-offs Wei-Fan Chiang School of Computing, University of Utah 1/31 Problem Statement Accelerating computations using graphical processing units has made significant

More information

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

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

More information

Rigorous Estimation of Floating- point Round- off Errors with Symbolic Taylor Expansions

Rigorous Estimation of Floating- point Round- off Errors with Symbolic Taylor Expansions Rigorous Estimation of Floating- point Round- off Errors with Symbolic Taylor Expansions Alexey Solovyev, Charles Jacobsen Zvonimir Rakamaric, and Ganesh Gopalakrishnan School of Computing, University

More information

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

Floating 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 information

Reproducibility BoF Position, Solutions

Reproducibility BoF Position, Solutions Reproducibility BoF Position, Solutions Triaging Races, Floating Point, Other Concerns Wei-Fan Chiang, Ganesh Gopalakrishnan, Geof Sawaya, Simone Atzeni School of Computing, University of Utah, Salt Lake

More information

Scientific Computing. Error Analysis

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

More information

Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition. Carnegie Mellon

Bryant 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 information

Floating Point January 24, 2008

Floating 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 information

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. 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 information

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

Floating 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 information

Floating 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. ! 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 information

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

Floating 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 information

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

Chapter 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 information

CS 6210 Fall 2016 Bei Wang. Lecture 4 Floating Point Systems Continued

CS 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 information

Written Homework 3. Floating-Point Example (1/2)

Written 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 information

Floating 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 (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 information

Systems 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 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 information

Floating Point Arithmetic

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

More information

Giving credit where credit is due

Giving 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 information

Computer (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 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 information

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

Floating 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 information

Giving credit where credit is due

Giving 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 information

Data Representation Floating Point

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

More information

Finite arithmetic and error analysis

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

More information

System Programming CISC 360. Floating Point September 16, 2008

System 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 information

Data Representation Floating Point

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

More information

Floating 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. 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 information

Floating 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 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 information

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

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

More information

Chapter Three. Arithmetic

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

More information

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

Floating 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 information

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

EE 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

EE878 Special Topics in VLSI. Computer Arithmetic for Digital Signal Processing

EE878 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 information

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

Floating 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 information

Number Representation

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 information

Inf2C - Computer Systems Lecture 2 Data Representation

Inf2C - 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 information

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

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer Arithmetic ECE 666 Part 4-B Floating-Point Arithmetic - II Israel Koren ECE666/Koren Part.4b.1 The IEEE Floating-Point

More information

Data Representation Floating Point

Data 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 information

Floating Point Numbers

Floating 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 information

Floating Point Numbers

Floating 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 information

Numerical Precision. Or, why my numbers aren t numbering right. 1 of 15

Numerical Precision. Or, why my numbers aren t numbering right. 1 of 15 Numerical Precision Or, why my numbers aren t numbering right 1 of 15 What s the deal? Maybe you ve seen this #include int main() { float val = 3.6f; printf( %.20f \n, val); Print a float with

More information

Floating Point Representation in Computers

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

More information

Floating Point Numbers

Floating 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 information

Computer Architecture and IC Design Lab. Chapter 3 Part 2 Arithmetic for Computers Floating Point

Computer Architecture and IC Design Lab. Chapter 3 Part 2 Arithmetic for Computers Floating Point Chapter 3 Part 2 Arithmetic for Computers Floating Point Floating Point Representation for non integral numbers Including very small and very large numbers 4,600,000,000 or 4.6 x 10 9 0.0000000000000000000000000166

More information

Chapter 3: Arithmetic for Computers

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

More information

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

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

More information

Signed Multiplication Multiply the positives Negate result if signs of operand are different

Signed Multiplication Multiply the positives Negate result if signs of operand are different Another Improvement Save on space: Put multiplier in product saves on speed: only single shift needed Figure: Improved hardware for multiplication Signed Multiplication Multiply the positives Negate result

More information

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

Numerical 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 information

Matthieu Lefebvre Princeton University. Monday, 10 July First Computational and Data Science school for HEP (CoDaS-HEP)

Matthieu Lefebvre Princeton University. Monday, 10 July First Computational and Data Science school for HEP (CoDaS-HEP) Matthieu Lefebvre Princeton University Monday, 10 July 2017 First Computational and Data Science school for HEP (CoDaS-HEP) Prerequisites: recent C++ compiler Eventually cmake git clone https://github.com/mpbl/codas_fpa/

More information

A Parameterized Floating-Point Formalizaton in HOL Light

A Parameterized Floating-Point Formalizaton in HOL Light NSV 2015 A Parameterized Floating-Point Formalizaton in HOL Light Charles Jacobsen a,1,2 Alexey Solovyev a,3,5 Ganesh Gopalakrishnan a,4,5 a School of Computing University of Utah Salt Lake City, USA Abstract

More information

Data Representation 1

Data Representation 1 1 Data Representation Outline Binary Numbers Adding Binary Numbers Negative Integers Other Operations with Binary Numbers Floating Point Numbers Character Representation Image Representation Sound Representation

More information

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

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

More information

Floating Point Numbers. Lecture 9 CAP

Floating Point Numbers. Lecture 9 CAP Floating Point Numbers Lecture 9 CAP 3103 06-16-2014 Review of Numbers Computers are made to deal with numbers What can we represent in N bits? 2 N things, and no more! They could be Unsigned integers:

More information

CS 261 Fall Floating-Point Numbers. Mike Lam, Professor.

CS 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 information

Roundoff Errors and Computer Arithmetic

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

More information

ecture 25 Floating Point Friedland and Weaver Computer Science 61C Spring 2017 March 17th, 2017

ecture 25 Floating Point Friedland and Weaver Computer Science 61C Spring 2017 March 17th, 2017 ecture 25 Computer Science 61C Spring 2017 March 17th, 2017 Floating Point 1 New-School Machine Structures (It s a bit more complicated!) Software Hardware Parallel Requests Assigned to computer e.g.,

More information

COMP2611: Computer Organization. Data Representation

COMP2611: 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 information

Today: Floating Point. Floating Point. Fractional Binary Numbers. Fractional binary numbers. bi bi 1 b2 b1 b0 b 1 b 2 b 3 b j

Today: 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 information

Arithmetic for Computers. Hwansoo Han

Arithmetic 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 information

Computer Arithmetic Floating Point

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

More information

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

Floating 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 http://xkcd.com/571/

More information

Computer 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 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 information

Bindel, Fall 2016 Matrix Computations (CS 6210) Notes for

Bindel, 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 information

Floating-Point Numbers in Digital Computers

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

More information

CS 261 Fall Floating-Point Numbers. Mike Lam, Professor. https://xkcd.com/217/

CS 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 information

Foundations of Computer Systems

Foundations 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 information

1.2 Round-off Errors and Computer Arithmetic

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

More information

CS429: Computer Organization and Architecture

CS429: 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 information

CS101 Lecture 04: Binary Arithmetic

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

More information

Floating Point Considerations

Floating 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 information

Numeric Encodings Prof. James L. Frankel Harvard University

Numeric 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 information

3.5 Floating Point: Overview

3.5 Floating Point: Overview 3.5 Floating Point: Overview Floating point (FP) numbers Scientific notation Decimal scientific notation Binary scientific notation IEEE 754 FP Standard Floating point representation inside a computer

More information

Computational Mathematics: Models, Methods and Analysis. Zhilin Li

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

More information

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University. Data Representation ti and Arithmetic for Computers Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Questions What do you know about

More information

Divide: Paper & Pencil

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

More information

Floating-point numbers. Phys 420/580 Lecture 6

Floating-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 information

CS321 Introduction To Numerical Methods

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

More information

Module 12 Floating-Point Considerations

Module 12 Floating-Point Considerations GPU Teaching Kit Accelerated Computing Module 12 Floating-Point Considerations Lecture 12.1 - Floating-Point Precision and Accuracy Objective To understand the fundamentals of floating-point representation

More information

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

10.1. Unit 10. Signed Representation Systems Binary Arithmetic 0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system

More information

Instruction Set extensions to X86. Floating Point SIMD instructions

Instruction Set extensions to X86. Floating Point SIMD instructions Instruction Set extensions to X86 Some extensions to x86 instruction set intended to accelerate 3D graphics AMD 3D-Now! Instructions simply accelerate floating point arithmetic. Accelerate object transformations

More information

Efficient floating point: software and hardware

Efficient floating point: software and hardware Efficient floating point: software and hardware David Bindel Rajit Manohar CS and ECE Cornell University 17 Oct 2011 Why this talk? Isn t this a lecture for an intro NA class? Yes: IEEE 754-1985 is ubiquitous

More information

Floating-point Error

Floating-point Error I am HAL 9000 computer production Number 3. I became operational at the Hal Plant in Urbana, Illinios, on January 12, 1997. The quick brown fox jumps over the lazy dog. The rain in Spain is mainly in the

More information

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

CSCI 402: Computer Architectures. Arithmetic for Computers (4) Fengguang Song Department of Computer & Information Science IUPUI. CSCI 402: Computer Architectures Arithmetic for Computers (4) Fengguang Song Department of Computer & Information Science IUPUI Homework 4 Assigned on Feb 22, Thursday Due Time: 11:59pm, March 5 on Monday

More information

Computer Organization: A Programmer's Perspective

Computer 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 information

CS 61C: Great Ideas in Computer Architecture Floating Point Arithmetic

CS 61C: Great Ideas in Computer Architecture Floating Point Arithmetic CS 61C: Great Ideas in Computer Architecture Floating Point Arithmetic Instructors: Vladimir Stojanovic & Nicholas Weaver http://inst.eecs.berkeley.edu/~cs61c/ New-School Machine Structures (It s a bit

More information

UC Berkeley CS61C : Machine Structures

UC Berkeley CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c UC Berkeley CS61C : Machine Structures www.cs.berkeley.edu/~ddgarcia Google takes on Office! Google Apps: premium services (email, instant vs messaging, calendar, web creation,

More information

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

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng. CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. CS 265 Midterm #1 Monday, Oct 18, 12:00pm-1:45pm, SCI 163 Questions on essential terms and concepts of Computer Architecture Mathematical questions on

More information

3.1 DATA REPRESENTATION (PART C)

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

More information

Floating-Point Numbers in Digital Computers

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

More information

IEEE Standard 754 for Binary Floating-Point Arithmetic.

IEEE Standard 754 for Binary Floating-Point Arithmetic. CS61C L14 MIPS Instruction Representation II (1) inst.eecs.berkeley.edu/~cs61c UC Berkeley CS61C : Machine Structures Lecture 16 Floating Point II 27-2-23 Lecturer SOE Dan Garcia As Pink Floyd crooned:

More information

ECE 645: Lecture 5 Number Representation

ECE 645: Lecture 5 Number Representation ECE 645: Lecture 5 Number Representation Part 2 Little-Endian vs. Big-Endian Representations Floating Point Representations Rounding Representation of the Galois Field elements Required Reading Endianness,

More information

Part V Real Arithmetic

Part 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 information

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

What we need to know about error: Class Outline. Computational Methods CMSC/AMSC/MAPL 460. Errors in data and computation Class Outline Computational Methods CMSC/AMSC/MAPL 460 Errors in data and computation Representing numbers in floating point Ramani Duraiswami, Dept. of Computer Science Computations should be as accurate

More information

Number Systems and Computer Arithmetic

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

More information

UNIT 7A Data Representation: Numbers and Text. Digital Data

UNIT 7A Data Representation: Numbers and Text. Digital Data UNIT 7A Data Representation: Numbers and Text 1 Digital Data 10010101011110101010110101001110 What does this binary sequence represent? It could be: an integer a floating point number text encoded with

More information

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

Computational Methods CMSC/AMSC/MAPL 460. Representing numbers in floating point and associated issues. Ramani Duraiswami, Dept. of Computer Science Computational Methods CMSC/AMSC/MAPL 460 Representing numbers in floating point and associated issues Ramani Duraiswami, Dept. of Computer Science Class Outline Computations should be as accurate and as

More information

CO212 Lecture 10: Arithmetic & Logical Unit

CO212 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 information