Brian writes:

> The bug doesn't hit all multiplication/division combos resulting in 65535.
> For example, =385.5*170 yielded the correct result.

These kinds of errors are among the hardest to find during testing. They
generally don't result from a simple mathematical mistake, as you might suppose,
but rather from the complexity of the underlying code that is trying to make
life easy for you.

The number 65535 is a magic number is programming. It's the largest positive
number capable of being stored in a 16-bit unsigned number (2^16 = 65536
distinct values) when counting from zero, as computers do. Quite probably,
whether or not you get the error will depend on whether you were multiplying
whole (integer) numbers together, or integers and reals (numbers with decimal
places), and in which order. These different kinds of numbers are represented by
completely different bit patterns, and before they can be multiplied, the cell
equation interpreter must determine the proper way to handle the values that
you've given it and convert the bit patterns so that they can be properly used.
In Excel, and in other spreadsheets, the equation interpreter does this on the
fly, as it reads the cell equation left-to-right, within the nested parentheses.

If I had to guess where the error is, it would be in this equation
interpretation code.

The error should never have been seen by the public. It should have been caught
in testing, but as we say in the computer business, "mutations happen," and some
errors slip through the most intense selective processes.

Wirt Atmar

Reply via email to