If you allow multiplication and division, you'd need to store not only
one type, but an expression like m.s^-2, etc. You'll end up with something
with Maple. Isn't there some free open source algebraic computation
toolkit with equations and units somewhere ?