Hi, I'm Matthew ūüĎč

I'm a Software Developer from New Zealand

Appropriate Units

4 minutes
January 10, 2011

Overview

Recently I have been programming a unit conversion system to automatically convert between units of different systems of measurement. So for example the standard metric system of volume is based on the litre (L) and multiples of it as determined by standard SI prefixes, for example a millilitre (mL). Values in this system can be converted to other systems such as an Imperial system comprising of fluid ounces (fl oz), quarts (qt), pints, (pt), and gallons (gal). Simple conversions between such systems are fairly simplistic, we follow these steps:

  1. We convert our initial measurement to an arbitrary value in the same system. For example we can divide a US gallon by 128 to get a fluid ounce.
  2. We convert to our standardised measurement for that system into a standardised measurement for the desired system. For example by dividing our measurement, now in US fluid ounces by 29.57 to convert it to millilitres. In practice this may go through a standardised base system, so we can convert from US fluid ounces to UK fluid ounces by going through an intermediary system such as metric system of litres.
  3. Now we have an accurate measurement in the new system. However our initial measurement in gallons now looks rather unwieldy in  millilitres. The obvious next step is to convert it back to a sensible measurement, maybe litres. Such a conversion is just a reversal of step one.

Easy right? What is the hard part in this process? The sheer amount of country specific systems is just tedious, but not difficult.

Question

One hard question arises:

When should we convert between units in the same system?

This part is going to be a bit of a thought experiment for me… It appears that no one has answered this question before. Or if they have, I can’t find it. We are taught to intuitively convert between units: 230 metres sounds right, 23,000 centimetres just sounds wrong. Even the BIPM, the official organisation of SI units has nothing to say. In talking to a few people there seems to be a vague conclusion as to what ‘sounds’ right. It seems to come to come down to the number of significant figures one plans to use and the size of the number. Lets explore a simple SI system, which is probably fairly consistent across all SI systems: The Metre (or Meter for you American types) -¬†1 m = 100 cm = 1,000 mm = 0.001 km

Some Rules

So using this, let’s tentatively set out some formal rules. Note, this is currently an experimental idea and not tested!

  1. We need to know value, initial unit, available units and the multiplier required to each (in the final system), and the final number of s.f. the number is required in.
  2. If current number characters in value (including commas, place holder zeroes and dots) < the number of characters of converted values, then it is the best choice.
  3. If this is tied, those with the lowest number place holder zeros are preferred. Followed by commas. Followed by dots (in systems where commas not dots separate large number strings).
  4. If all else fails, the unit closest the default should be used, presumably this will be a little more familiar and useful - at least for SI systems.
  5. For values with low significant figures (where s.f. <  4), step iii. will be pretty much irrelevant.
  6. If the total length is > s.f. + 5 then scientific notation should be used.
  7. For unit systems outside a standard metric view, use the larger unit.

Here you go sir, your units shaken not stirred. Does this make logical sense to you? Any comments?