Floting Point Numbr Sstm -(.3). Floting Point Numbr Sstm: Comutrs rrsnt rl numbrs in loting oint numbr sstm: F,k,m,M 0. 3... k ;0, 0 i, i,...,k, m M. Nottions: th bs 0, k th numbr o igits in th bs xnsion 0.034580 or k 8, 0 m th minimum xonnt 0 M th mximum xonnt,0 Exml: F0,,0, 0, 0., 0. 0, 0. 0 ;,,...,9, n 0,,,...9 () F0,,0, contins 903 54 numbrs. () Thsmllst mgnitu is 0 n th lrgst mgnitu is 0.99 0 99. This sstm cnnot rrsnt n numbr tht is lrgr thn 99. An comuttion xcs th lrgst numbr will cus n ovrlow xction (comutr stos) n th smllr nonzro numbr will cus unrlow (unxct 0). Unxct zros will lso cus n ovrlow roblm. For xml, F0,,0, 0.09. 0 (3) Th numbr nxt to 0 (rom th right) in F0,,0, is 0.0. So, rl numbr in 0, 0. is rrsnt b ithr 0 or 0.. In othr wors, 0 or 0. rrsnts mn rl numbrs.. Roun-o Errors: Roun-o rrors is rouc whn clcultor or comutr is us to rorm rl numbr clcultions. Tht is bcus th rithmtic rorm in mchin involvs numbrs with onl init numbr o igits n th clcult rsults r onl roximtions o th ctul numbrs. Lt brl numbr n l b loting oint numbr in F,k,m,M rrsnting. Suos tht 0. 3... k k...0 n ( 0). Choing mtho: l c 0.... k 0 n Rouning mtho: l r 0.... k 0 n i k 5 0.... k 0 n i k 5 Exml Giv th loting -oint orm o using 5-igit choing; n b 5-igit rouning. 3. 4596535897934 0.34596535897934 0 l c 0.345 0 b l r 0.346 0 3. Absolut Error n Rltiv Error: Lt b n roximtion to. Thn th bsolut rror is in s n th rltiv rror is in s rovi tht 0. Rltiv rrors or choing roximtions:
0.... k k...0 n, l c 0.... k l c 0. k k...0 n k.0 0 n k 0 n k 0.... k...0 n 0.00...0 n 0 n l c 0n k 0 k 0 n Rltiv rrors or rouning roximtions: 0.... k k...0 n, l r 0.... k i k 0.5 0.... k i k 0.5 l r 0. k k...0 n k i k 0.5 0.00 k k...0 0 k i k 0.5 0.5 0 n k i k 0.5 0.05 k...0 0 k i k 0.5 0.5 0n k l r 0n k n l r 0 k From th ur bouns or choing n rouning roximtions, w lrn rouning roximtion is bttr in gnrl. Th Mchin Prcision: Th mchin rcision u is givn b u Signiicnt bs igits: Suos tht t l t 0 k choing 0 k rouning. or som ositiv intgr t. Thn w s tht l n gr to t lst t n t most t signiicnt bs igits. Exml Lt n l r 0.346 n l c 0.345. Fin th bsolut rrors n rltiv rrors o ths roximtions n trmin th numbrs o signiicnt ciml igits. 0.346 0 0.00000734640 0 6 0.346 0 0.0 0 6 0 5. 33843499780454 0 6 Hnc, th numbr o signiicnt ciml igits or is roximt b l r 0.346 is 5.
0.345 0 0.00009653590 0 5 0.345 0 0.0 0 5 0 4. 949554 0 5 Hnc, th numbr o signiicnt ciml igits or is roximt b l c 0.345 is 4. Exml Lt 0.3 0 4, n 0.30 0 4 ; n lt 0.3 0 4, n 0.30 0 4. Comut th bsolut rror n rltiv rror or ch roximtion. 0.30 0 4 0.3 0 4 0.00000 0.30 0 4 0.3 0 4 0.3 0 4 0.0358064569 0.30 0 4 0.3 0 4 00.0 0.30 0 4 0.3 0 4 0.0358064569 0.3 0 4 Th bsolut rror o is much lrg thn th on or, th rltiv rrors or both n r th sm. From this xml, w s tht th bsolut rror ns on th mgnitu o, on th othr hn, th rltiv rror os not n on th mgnitu o. So, th rltiv rror is usull us to vlut th closnss o th roximtion. 4. Th IEEE Stnr: Th signrs o th IEEE (Institut or Elctricl n Elctronics Enginrs) 754-985 binr loting oint rithmtic stnr slct bso(. Th singl n oubl rcision loting oint numbr sstms r F,4, 5,8 n F,53, 0,04, rsctivl. For xml, singl rcision: 0.0 3 5 4 3. 65 Th smllr n lrgr numbrs r: s 0. 00... 4 igits 3 6... 4 4 6... 4 3 8 3. 649998 6 9 4 l 0. 00...0 4 igits 3 5 4 4 3. 65000 Hnc, 0.0 3. 65 rrsnts mn numbrs in th intrvl s, l 3. 649998, 3. 65000. 3
r Th smllst ositiv numbr n th lrgst numbr in th oubl rcision loting oint sstm smllst 0....00 0 0.50739 0 308 53 igits lrgst 0.... 04... 04 5 53 igits 53 04. 797693 0 308 53 04 loting oint sstm mchin rcision (rouning) smllst ositiv numbr lrgst ositiv numbr singl rcision oubl rcision u 4 5. 960 0 8 u 53.0 0 6 5 8 4.754944 0 38 3. 408 0 38 0 04 53.50739 0 308.79769 0 308 5. Floting Point Arithmtic In comuttion, rouning rror ccumults in loting oint ortions. 3 Exml Us 5-igit rouning rithmtic to rorm th clcultion 3. x x x x x x x x 0. 33333 0.50000 0.783 0 0.44 0 3 3 0.6667 3 0.8549 0 3 0.9569 0 3 3 0.748 0, 3 3 3 3 0.74747 0 0.748 0 rltiv rror 0.748 0 0.74747 0 0.74747 0 0.05 0 4 Exml Solv...0 3.8 x 3. 5.7. Rcll tht th sstm solution is c b x hs uniqu solution i bc 0 n th 4
x c b bc c b For our roblm, bc.3.8..0 4. 4. 0. So, th sstm os not hv uniqu solution. b Is th sstm consistnt? Tht is, is in th rng o? How to chck this? c Rcll, i th rnk c b n th rnk b c r th sm, thn th sstm hs ininitl mn solutions, othrwis th sstm is inconsistnt (no solution). W know rnk Chck th rnk o.. 3..0 3.8 5.7 Gussin Elimintion.0. R R R.. 3. 0 0 5.7.0 3. 5.7.83. 5.7 5.6 5.7 0. 0. Th sstm hs no solution....0 3.8. Exml Solv th qution x 6.0x 0 using 4-igit rouning rithmtic. W know i b 4c 0 thn th qution x bx c 0hstworlsolutionsnthr x b b 4c, x b 4c Now comut x n x st b st in 4-igit rouning rithmtic: St Exrssion Vlu b 6.06.0 3856. 4 3856 b 4c 3856 4 385 3 b 4c 385 6. 06448596736 6.06 4 b b 4c 6.0 6.06 0.04 5 6 b b 4c 0.04 0.0 x 7 b 4c 6.0 6.06 4. 6 3. 8 b 4c 3. 6.6 x Tru solutions (or solutions comut using k-igit rouning rithmtic whr k 4 : 5
Rltiv rrors: b 4c 6.06.0 4 6. 067786 x x x x x x x x 6.0 6. 067785558 6.0 6. 067785558 0.0 0.0607 0.0607 6.6 6. 08389 6. 08389 0.06076 6. 083896 0.468 7. 79476 0 3 Wh th roximtion o x is so oor? Not tht St 4 involvs subtrction o two clos numbrs. Chck out th rltiv rror or this subtrction: roximtion - tru - irnc tru irnc 0.04 6.0 6. 067786 6.0 6. 0677855 0.4677855 I th subtrction o two numbrs in clos mgnitus cn b voi, thn th ccurc o th comuttion o x cn b imrov. Rwrit th ormul or x : x b b 4c b b 4c b 4c x b b 4c c b 4c b 4c b 4c x 3.. 633766 0.63 0 x x x.63 0 0.0607 0. 06 07 7. 65795 0 3 6