Of Number Representations
© 1 May 2013 Luther Tychonievich
Licensed under Creative Commons: CC BY-NC-ND 3.0
other posts


Three ways to handle numbers involving non-trivial operations.


I’ve written here several times about number representations in the past, but it is a topic that deserves still more discussion.

The simplest representations are additive. Three is “‍III‍”, seven is “‍IIIIIII‍”. Various groupings and subtractive additions are often added because people can’t count very high without noticeable effort.

The next simplest representations are place-valued. See my post on the topic. Place-value whole numbers work nicely for adding, subtracting, and multiplying.

Division, though, doesn’t work very nicely with place-value whole numbers. There are roughly three ways to get around this. One is to use a logarithmic scale, making division simple at the cost of making addition difficult. Another is to use decimal points, but these require infinite space so approximations start to proliferate. A third approach is rational numbers, which leaves the division operations in the number unevaluated.

These three approaches show three general paths that can be used when adding any new operation to a set of numbers. We can let the new operation work nicely as the expense of other operations (logarithmic); we can just approximate answers (decimal point); or we can leave the operations in the representation of the number (rational).

Most existing systems chose the approximation route. It is nice because it is general; new operations can be added fairly easily. But approximation leads to a problem called “‍numerical stability‍” where using operations in the wrong order can result in bad answers. For example, 10100 + 1 - 10100 with approximate arithmetic working left-to-right gives 0 because 10100 + 1 = 10100 to any reasonable number of digits; but re-ordering it 10100 - 10100 + 1 gives 1 instead. There are entire fields of study devoted to finding numerically stable ways solve every-day problems.

Including operators in the representation is uncommon unless the operators come from an unusually small and well-behaved set. The problem often faced is that it is hard to compare two expressions containing operators. Even if the only operator added is the square root, there are odd identities like √(3 + 2√2) = 1 + √2.

Using a representation that works only for the particular operations needed but not for common operations like addition is not often possible, but when it is it can create surprisingly elegant solutions to problems. I used this myself when discussing hyperbolic tiles.

It sometimes bothers me that for most problems I approach there is no clean solution other than using approximate numbers. Life would be so much cleaner if mathematics was better behaved and exact expressions were feasible. Alas, it is not so.

Looking for comments…

Loading user comment form…