wpe41.gif (23084 bytes)CIS3355: Business Data Structures
Fall, 2008
 

How do we deal with issues of precision?

We have already defined precision as the degree of accuracy to which we can represent a value. Obviously, we would like to represent all values as precisely as possible, but we know that we can't:

As far as we know, the value of pi is an infinite number
(no matter how good technology gets, we will never have an infinite number of bits)

Let's review how we isolated the components:

 π = + 3.14159 =  +.314159 E +1

The component in which we store the sequence of digits is called the mantissa (by definition: The decimal part of a logarithm. In the logarithm 2.95424, the mantissa is 0.95424). Because we have normalized the number (by putting the decimal point in front of the first significant digit), we are capturing the entire sequence of digits.

I don't see what this has to do with precision ???

The more bits we allocate to the mantissa component of a real number, the more precisely we can represent the number. Let's consider the √2 (The square root of two). Here are the first 1,000 digits in the mantissa:

1. 4142135623 7309504880 1688724209 6980785696 7187537694 8073176679 7379907324 7846210703 8850387534 3276415727 3501384623 0912297024 9248360558 5073721264 4121497099 9358314132 2266592750 5592755799 9505011527 8206057147 0109559971 6059702745 3459686201 4728517418 6408891986 0955232923 0484308714 3214508397 6260362799 5251407989 6872533965 4633180882 9640620615 2583523950 5474575028 7759961729 8355752203 3753185701 1354374603 4084988471 6038689997 0699004815 0305440277 9031645424 7823068492 9369186215 8057846311 1596668713 0130156185 6898723723 5288509264 8612494977 1542183342 0428568606 0146824720 7714358548 7415565706 9677653720 2264854470 1585880162 0758474922 6572260020 8558446652 1458398893 9443709265 9180031138 8246468157 0826301005 9485870400 3186480342 1948972782 9064104507 2636881313 7398552561 1732204024 5091227700 2269411275 7362728049 5738108967 5040183698 6836845072 5799364729 0607629969 4138047565 4823728997 1803268024 7442062926 9124859052 1810044598 4215059112 0249441341 7285314781 0580360337 1077309182 8693147101 7111168391 6581726889 4197587165 8215212822 9518488472 08969

If that is not precise enough for you, NASA can provide you with the first 5 million digits in the mantissa.

How many bits will we need to represent a number like that ??

Good question. Let's assume that we wanted to store (unsigned) integers:

Bits Available Largest
Integer
Precision
Level
10 1023 3
100 1267650600228229401496703205376 30
1000 1.07150860718626732094842504906e+301 300
10000 1.9950631168807583848837421626836e+3010 3009

Basically, what we are saying is that I wanted to store a number to 300 digits of precision, I would need 300 bits.

Wait !!! You are saying that with 10 bits, you can represent integers as large as 1023 (I understand that). But then you say you only get a precision level of 3 digits. There are 4 digits in the value 1023 !!

Quite true. However, I CAN NOT represent all 4 digit numbers. For instance, I can not represent the integer 1241 with only 10 bits. I CAN, however, represent all numbers to 3 decimals of precision (which is why we state that with 10 digits, I have 3 decimal points of precision).

It would be more accurate to state that given 10 bits, I can represent ALL three-digit numbers and SOME four-digit numbers.

OK. But how do I deal with issues of magnitude ??

That will be our next tutorial.

This page was last updated on 05/31/05