Tuesday, May 20, 2008

Mechanics' Floating Point

Several years ago (Fall 1993) I gave a presentation at Novell, as part of their informal lecture series, named "Food For Thought." Somewhere in a dusty archive there may still be a VHS video tape of the presentation, which was entitled "My Computer Can't Add." I presented part of this again during a job interview at UVSC in 2001.

The idea of a computer not being able to add may seem odd. But, a computer doesn't actually deal with numbers, but only with representations of numbers. Except for some very simple and small numbers, the representations are not completely accurate. Part of the problem is round-off errors. The rest of the problem comes from the fact that the representations are far from being a complete set, as only some of the numbers are actually represented at all.

Until recently, personal computers only represented integers between -2147483648 and 2147483647. Granted, those aren't small numbers (as in "pick a number between 1 and 100"), but they aren't big enough to handle the national debt. Newer computers are using 64 bit processors, enabling them to represent integers between -9223372036854775808 and 9223372036854775807.

However, money values and numbers used in scientific computations are generally handled by the "floating point" representation. Here one can represent approximations to real numbers in a larger range than the integer representations provide, but giving up precision. The floating point representation generally uses either 32 or 64 bits, but uses the bits differently than the way they are used when representing integers.

To make this clear, I invented "Mechanics' Floating Point" for the purpose of my presentation. This uses a floating point style representation inside of just 8 bits to represent numbers between 1 sixteenth and 8 (well, almost--the largest number representable in the scheme is actually 7 and 3 quarters). Choosing 8 bits allows one to enumerate all of the representations possible in 8 bits (there are just 256 of them (see "Powers of two")).

In a subsequent post, I will try to find a way to display the entire representation of Mechanics' Floating Point.

1 comment:

Myrna said...

Only you could make floating points sound interesting to me! I even WANT to read the next post, even though I know it is mathematical.