Puzzle #1: IEEE 754 floating point

Why is 1/3 * 3 = 1 on most computers and many calculators? It didn't used to be... The representation of the fraction [1/3] is a repeating decimal or binary number, and we know that a computer or calculator is going to truncate after some number of digits or bits. Yet on almost all computers and most calculators 1/3 * 3 is exactly 1. Why?

On a cheap pocket calculator, an expensive calculator, in your favorite programming language, and in your favorite spreadsheet, determine what is the smallest integer i > 0 such that the floating point computation 1/i * i != 1. (If you do this in a program, try both single and double precision.)

Try to determine the machine e for your devices, which is the smallest number such that 1+e > 1.

Last updated: January 18, 2000