Any comments on what the empirical rules for special units should be, or other special units, as I am adding this to my general format routines in javascript (below)
Currently handle seconds, kg, m, g specially.
//Suffix = unit name
function SpecialSuffix(number,suffix) { //deal with units that have special customary rules
var DoM = true; //DoMultipliers ie use multiplier prefixes
var UseTonnes = true; //use Tonnes for 1000kg
switch (suffix) {
case "m": //metres - only use multipliers up to km
if ( number >= 1e6 ) {
DoM = false;
}
break;
case "s": //seconds - never
DoM = false;
break;
case "kg": //kg
if ( number<1 ) { //change to grams below 1kg
number = number / 1000;
suffix="g";
break;
}
if (( UseTonnes ) and ( number >=1e3 )) { //Tonnes do have +multipliers (k,M,G etc
number = number/1000;
suffix = T;
break;
}
//else...
DoM = false; //never use multipliers > kg
break;
case "g": // grams
if ( number>=1e6 ) {
DoM=false;
}
} //switch
return {DoM,number,suffix};
}