Nat Pryce wrote:

> I think you have a modelling problem, rather than an implementation
> problem. Roman numerals are not numbers, they are a way of *representing*
> numbers
> symbolically.  (To be precise, they are a way of displaying natural
> numbers).  So you might want to write a NaturalNumber class and then
> provide functions to write convert numbers to strings in Roman Numeral
> notation. However, the natural numbers are just a subset of integers, so
> you might as well stick with integers, and define preconditions on the
> roman numeral printing functions that are tested with unit tests.

In many cases you are right: this is the "character vs. glyph" problem, IE, 
that the *idea* of the number is not the same as how that number is 
represented.

Howover, you assumed that I really was talking about Roman Numerals, which 
I wasn't (although I used them in the example).  What I was really trying 
to do was write a bitwise implementation of a balanced ternary number 
system; while Integers are used in the class, this is only because I needed 
a three-way boolean.  All operations are done using bits, not their integer 
counterparts.  Therefore, my BTernary numbers are representations of 
Integers just as much as Integers are representations of bit arrays.

This isn't anything practical; it is just a mental exercise to see how a 
trinary numeric system would work.

Thanks.

--- SER