Sixty-five thousand five hundred thirty-five
Posted on September 30th, 2007 by Bob Hall in Tangents65535
Numbers are one of the things that make us as humans unique. I have read of no other species that utilizes advanced math. I was born in 1967 and there was an emphasis in my early education on “new math” they were teaching us to count, multiply, add, subtract, and divide in base two (binary), eight (octal), base six, and thirteen (the last two don‘t make any sense; as if the others do?).
We as humans are normally born with eight fingers, two thumbs, and ten toes. Base 10 is where we tend to concentrate. Computers on the other (two fingered hand) work a bit differently. 65535 is a number that you have likely seen and should stand out. 65535 is the highest number which can be represented by an unsigned 16 bit binary number (1111111111111111) or FFFF Hex. 65535 can be expressed as 2^16-1 (two to the power of sixteen, minus one). This is also the maximum number of rows that Excel 2003 allows .
I find it particularly fascinating as it is unique and it is made up in a way that few numbers can be across two base counting systems. 65535 can be represented by the prime factorization of 3 x 5 x 17 x 257. This is special in base 2 as the product of the first four Fermat primes: 65535 = (2 + 1)(4 + 1)(16 + 1)(256 + 1) .
This is where Microsoft got into trouble. The 2007 version of Excel has a significant problem in their floating point math representation of 65535. Floating point is the commonest way to represent decimal values in computers (there are other more computationally expensive techniques that are used in financial calculations). Floating point uses a series of binary fractions to approximate a decimal value. Floating point is particularly efficient as the radix point (decimal) is allowed to float (hence floating point) so that the most number of significant digits can be utilized and a very large range of numbers accommodated.
The logic here is actually pretty sound. If you are working with very large numbers, five or six decimal places are absolutely insignificant. Alternatively if you are measuring the space between atoms, you want every one of those 24 bits representing the mantissa (the fractional part to the right of the decimal). Floating point math has a really hard time with .1 in that it can not represent it. Given this limitation and the 65535 “magic number” lets have some fun.
850 * 77.1 is a reasonably decent calculation that you may need performed. The correct answer is our favorite 65,535. Excel 2007 proudly and incorrectly displays 100,000 as the answer. Someone screwed the floating point “optimizations.”
If you have made it this far, you have to be wondering why on earth I wrote this blog. I went to a University that only offered “science” and no “art” degrees. The professors were sacred about this kind of stuff and beat it into us like a passionate ministers of their trade. What is really scarry if that we got into arguments over this kind of stuff.
