# Lect12 - Floating Point Arithmetic and Dense Linear Algebra...

This preview shows pages 1–8. Sign up to view the full content.

1 Floating Point Arithmetic and Dense Linear Algebra Lecture 12 CS 594 Jack Dongarra 2 Question: ± Suppose we want to compute using four decimal arithmetic: ± S = 1.000 + 1.000x10 4 – 1.000x10 4 ± What’s the answer? ± Ariane 5 rocket ± June 1996 exploded when a 64 bit fl pt number relating to the horizontal velocity of the rocket was converted to a 16 bit signed integer. The number was larger than 32,767, and thus the conversion failed. ± \$500M rocket and cargo

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 3 Two sources of numerical error 1) Round off error 2) Truncation error 4 Round off Error ± Caused by representing a number approximately
3 5 Problems created by round off error ± 28 Americans were killed on February 25, 1991 by an Iraqi Scud missile in Dhahran, Saudi Arabia. ± The patriot defense system failed to track and intercept the Scud. Why? 6 Problem with Patriot missile ± Clock cycle of 1/10 seconds was represented in 24-bit fixed point register created an error of 9.5 x 10 -8 seconds. ± The battery was on for 100 consecutive hours, thus causing an inaccuracy of .1 (decimal) = 00111101110011001100110011001101 (binary)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 7 Problem (cont.) ± The shift calculated in the ranging system of the missile was 687 meters. ± The target was considered to be out of range at a distance greater than 137 meters. 8 Truncation error ± Error caused by truncating or approximating a mathematical procedure.
5 9 Example of Truncation Error Taking only a few terms of a Maclaurin series to approximate If only 3 terms are used, 10 Defining Floating Point Arithmetic ± Representable numbers ± Scientific notation: +/- d.d…d x r exp ± sign bit +/- ± radix r (usually 2 or 10, sometimes 16) ± significand d.d…d (how many base-r digits d?) ± exponent exp (range?) ± others? ± Operations: ± arithmetic: +,-,x,/,. .. » how to round result to fit in format ± comparison (<, =, >) ± conversion between different formats » short to long FP numbers, FP to integer ± exception handling » what to do for 0/0, 2*largest_number, etc. ± binary/decimal conversion » for I/O, when radix not 10

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 11 IEEE Floating Point Arithmetic Standard 754 (1985) - Normalized Numbers ± Normalized Nonzero Representable Numbers: +- 1.d…d x 2 exp ± Macheps = Machine epsilon = 2 -#significand bits = relative error in each operation smallest number ± such that fl( 1 + ± ) > 1 ± OV = overflow threshold = largest number ± UN = underflow threshold = smallest number ± +- Zero: +-, significand and exponent all zero ± Why bother with -0 later Format # bits #significand bits macheps #exponent bits exponent range ---------- -------- ----------------------- ------------ -------------------- ---------------------- Single 32 23+1 2 -24 (~10 -7 ) 8 2 -126 - 2 127 (~10 +-38 ) Double 64 52+1 2 -53 (~10 -16 ) 11 2 -1022 - 2 1023 (~10 +-308 ) Double >=80 >=64 <=2 -64 (~10 -19 ) >=15 2 -16382 - 2 16383 (~10 +-4932 ) Extended ( 80 bits on all Intel machines ) 12 IEEE Floating Point Arithmetic Standard 754 - “Denorms” ± Denormalized Numbers: +-0.d…d x 2 min_exp ± sign bit, nonzero significand, minimum exponent ± Fills in gap between UN and 0 ± Underflow Exception ± occurs when exact nonzero result is less than underflow threshold UN ± Ex: UN/3 ± return a denorm, or zero
7 13 IEEE Floating Point Arithmetic Standard 754 - +- Infinity ± +- Infinity: Sign bit, zero significand, maximum exponent ± Overflow Exception ±

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/01/2010 for the course COMPUTER S cs202 taught by Professor Jiuhui during the Spring '08 term at 東京国際大学.

### Page1 / 30

Lect12 - Floating Point Arithmetic and Dense Linear Algebra...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online