### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# Scientific Computation ECS 231

UCD

GPA 3.75

### View Full Document

## 12

## 0

## Popular in Course

## Popular in Engineering Computer Science

This 4 page Class Notes was uploaded by Ashleigh Dare on Tuesday September 8, 2015. The Class Notes belongs to ECS 231 at University of California - Davis taught by Staff in Fall. Since its upload, it has received 12 views. For similar materials see /class/191713/ecs-231-university-of-california-davis in Engineering Computer Science at University of California - Davis.

## Reviews for Scientific Computation

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/08/15

ECS231 Handout 2 Floating Point Arithmetic April 2 2009 1 Floating point representation scienti c notation of numbers for example 7 U 7 31416 x 101 e exponem sign signi cand base Computers use binary arithmetic representing each number as a binary num ber The oating point representation of a nonzero binary number x is of the form as 1111121122 b1 x 2E 1 a It is normalized ie b0 1 the hidden bit b Precision p is the number of bits in the signi cand mantissa in cluding the hidden bit c Machine epsilon e 2 1 1 the gap between the number 1 and the smallest oating point number that is greater than 1 d The unit in the last place ulpm 270771 X 2E e X 2E If x gt 0 then ulpz is the gap between z and the next larger oating point number If x lt 0 then ulpz is the gap between z and the smaller oating point number larger in absolute value Special numbers 0 70 oo foo NaN Not a Number IEEE754 oating point standard IEEE 1987 essentials 0 consistent representation of oating point numbers by all machines adopt ing the standard 0 correctly rounded oating point operations using various rounding modes 0 consistent treatment of exceptional situation such as division by zero IEEE single format takes 32 bits long 4 bytes 23 A E l f 1 exponent lt 8 lt 181 sign binary point fraction It represents the number 71 gtlt 2E7127 Note that the leading 1 in the fraction need not be stored explicitly because it is always 1 This hidden bit accounts for the 1 here The E 7 12777 in the exponent is to avoid the need for storage of a sign bit The range of positive normalized numbers is from Nmin 100 0 x 2426 2426 12 x10 38 Nmax 111 1 x 2127 2 7 2 23 x 2127 z 2128 z 34 x1038 H a T 00 to Special repsentations for O ioo and NaN zero 1 i 1 00000000 1 00000000000000000000000 1 ioo 1 i 1 11111111 1 00000000000000000000000 1 NaN 1 i 1 11111111 1 otherwise 1 IEEE double format takes 64 bits long 8 bytes 1 lt 11 1 lt 52 1 1 8 1 E 1 f 1 sign exponent binary point fraction It represents the numer 71f gtlt 2E71023 The range of positive normalized numbers is from Nmin 24022 x 22 x 10308 to me 111 1 x 21023 x 21024 x 18 X10308 Special repsentations for 0 ioo and NaN IEEE extended format with at least 15 bits available for the exponent and at least 63 bits for the fractional part of the signi cant Pentium has 80 bit extended format Precision and machine epsilon of the IEEE formats Format Precision p Machine epsilon e 2 1 single 24 e 2 23 z 12 x 10 7 double 53 e 2 52 z 22 x 10 16 extended 64 e 2 63 z 11 x 10 19 Rounding Let a positive real number x is in the normalized range ie Nmin x Nmax and write in the normalized form z 1121112 bp1bpbp1 x 2E Then the closest oating point number less than or equal to z is m 1121122 b1 x 2E ie m is obtained by truncating The next oating point number bigger than m is 1 151122 42711 00001 x 2E therefore also the next one that bigger than x If x is negative the situtation is reversed Correctly rounding modes H 0 round down roundm 7 round up roundm 1 0 round towards zero roundm m of z 2 O roundm m1 of x g 0 0 round to nearest roundm m or 1 whichever is nearer to m except that if z gt Nmax roundm gt07 and if z lt 7Nmax roundm 700 In the case of tie7 ie7 m and at are the same distance from m the one with its least signi cant bit equal to zero is chosen When the round to nearest IEEE default rounding mode is in effect7 abserrm lroundz 7 ml u1pz d 7 1 relerrz w 7e M 2 Therefore7 we have 21r24 224 z 596 108 the max rel representation error 5252 z 111 x 10 IEEE rules for correctly rounded oating point operations if z and y are correctly rounded oating point numbers7 then 1W y FOUHCW y 90 y1 5 z 7 y roundz 7 y y1 6 z x y roundz x y m x y1 6 1LWu FOUHdWy y1 5 where 6 g e for the round to nearest7 IEEE standard also requires that correctly rounded remainder and square root operations be provided 12 IEEE standard response to exceptions Event Example Set result to lnvalid operation 007 0 x 00 NaN Division by zero Finite nonzero0 ioo Over ow gt Nmax ioo or iNmax under ow z 7 O7 lt Nmin i0 iNmin or subnormal lnexact Whenever z o y 7 z o y correctly rounded value 13 Further Reading the following article based on lecture notes of Prof W Kahan of the University of California at Berkeley provides an excellent review of IEEE oat point arithmetics D Goldberg What every computer scientist should know about oating point arithmetic ACM Computing Surveys 18154187 1991 The following recent published textbook gives a broad overview of numerical computing7 with special focus on the IEEE standard for binary oating point arithmetic M Overton Numerical computing with IEEE oating point arithemetic SIAM7 Philadelphia7 2001 ISBN 089871 482 6 Student price 2000 directly from wwwsiamorg

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

#### "Selling my MCAT study guides and notes has been a great source of side revenue while I'm in school. Some months I'm making over $500! Plus, it makes me happy knowing that I'm helping future med students with their MCAT."

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.