For a very tidy and typesafe implementation of units I would recommend checking out the units feature in F#.
http://blogs.msdn.com/b/andrewkennedy/archive/2008/08/29/units-of-measure-in-f-part-one-introducing-units.aspx Probably not the best link, but the compiler will flag if units are not consistent in computations. Also accept they adopt a 'tagging' system to declare units, but conversely it is very extensable to any set of defined units. K
