# Errors and rounding.  How tall are you?  What is that in centimetres?  So how tall are you in millimetres?  Margin of error  Sometimes acceptable.

## Presentation on theme: "Errors and rounding.  How tall are you?  What is that in centimetres?  So how tall are you in millimetres?  Margin of error  Sometimes acceptable."— Presentation transcript:

Errors and rounding

 How tall are you?  What is that in centimetres?  So how tall are you in millimetres?  Margin of error  Sometimes acceptable  What happens when we start doing operations though?

 00.5 1.0  Move number to nearest ‘significand’  Easy.  What about 0.5?  Round-up  Round to even, statistician’s rounding, banker’s rounding  Rounding towards zero (truncating)

Do these calculations using the prices corrected to the nearest penny.  How much do motorists pay for petrol in Hereford?  Petrolprices.com take an average of the three prices given.  If we have a 60 litre tank, how much does it cost to fill it? (Assume it is empty to start).  What if we used ‘super’ to fill the same tank? What is the difference?  What if we used diesel to fill the same-size tank? What is the difference? Now repeat the calculations but don’t correct the prices. Are your results the same?

 How do you store a fraction in a computer?  ½ easy = 0.5  1/3 more difficult = 0.33333333333333333…33  How many bits are allocated (allowed) for one number? If no limit could use all of a computers memory on one fraction!

 Most computers use IEEE standard for ‘floating point numbers’  Provides a way to store fractions in the space of an 8- byte number  But, for most numbers it involves an approximation  ‘rounding’ “correct” number  to nearest whole number  X decimal places  X significant figures  ‘truncation’ just cut number off at specified limit

 Whole numbers = (x*1 + x*2+x*4+x*8+x*16etc)  Can store any whole number  Fractions = (x*1/2+x*1/4+x*1/8+x*1/16etc)  How would you convey 1/10?  Computers work to 15 decimal places.

 Division = sharing  Divide these 50 marbles between these 5 buckets

 Division = sharing  Divide these 50 marbles between these buckets:

 Division by zero crashes programmes  In spreadsheets it returns ‘error’ messages

Overflow  Calculation returns value too large for storage location  Too much memory is being used or required Underflow  Calculation returns a value which is too small (ie too close to zero) {fractions are tricky}  Flush to zero  Gradual underflow; subnormal numbers

 88% of spreadsheets have errors  Research: Bad math rampant in family budgets and Harvard studies  http://www.marketwatch.com/story/88-of-spreadsheets-have-errors-2013-04-17 http://www.marketwatch.com/story/88-of-spreadsheets-have-errors-2013-04-17  European Spreadsheet Risks Interest Group European Spreadsheet Risks Interest Group  Peer review  Software programs

 Access this website:  Eight of the worst spreadsheet blunders  http://www.cio.com/article/131500/Eight_of _the_Worst_Spreadsheet_Blunders?page=4&ta xonomyId=3000 http://www.cio.com/article/131500/Eight_of _the_Worst_Spreadsheet_Blunders?page=4&ta xonomyId=3000  Take one of the stories:  find out what happened  explain it to the rest of the class  what was the loss  what was the lesson learnt?

 Open excel  Goto top left (A1)  Enter 1 – copy value to 4 rows beneath  Go to A1, go right 1 cell (B1)  Enter 3 – copy value to 2 rows beneath  Goto B4, enter 6, copy value to B5  Goto C1, enter “=A1/\$B\$1”  Copy formula to C2 and C3

 Add the result of C1,C2 and C3 in your head  Note your answer  Insert a row below row 3  Goto C4  Enter =sum(C1:C3) – is this the same as your result? Who is correct?

 Copy the formula from C3 to C5  Is the result as expected?  Absolute vs relative referencing

 These happen in the real world with major consequences!  Financial loss (corporate level)  Job loss (individual level)  Transcription  Wrong sign  Allowing access to wrong people, wrong version or at wrong time  Using formatting to hide data instead of removing it  Adding too many zeros  Cut and paste  Incorrect data (typo, transcription error)  Incorrect formula (typo, cut & paste)

1. Convert to binary: 63, 15, 48, 7, 52 2. Convert from binary to decimal: 1101, 11001100, 0011001101, 10101010 3. Convert to hexadecimal from decimal via binary: 15, 18, 33, 61, 46 4. Find the errors in the spreadsheetspreadsheet 5. Use the following example to explain two’s complement: a) 11-63 b) 2-1 (use this to explain why we use it, rather than sign & magnitude).

Download ppt "Errors and rounding.  How tall are you?  What is that in centimetres?  So how tall are you in millimetres?  Margin of error  Sometimes acceptable."

Similar presentations