pretty-units
Have you received a measurement that had an unsightly or unpredictable order of magnitude?
pretty-units will find a number's largest satisfiable order of magnitude and provide a string representation that includes both the number and a unit prefix. All you need to do is append your unit!
pretty-units supports transformation from yocto (10-24) to yotta (1024) and everything in between!
Output is always rounded to two decimal places. Naturally, this means that pretty-units specially handles values that have an absolute value that is less than 10-26. See usage for more details.
Usage
> var punits = ; > + 'm';'9 km' > + 'l';'1 ml' > + 's';'1 Ts' // use a custom exponent of 10> + 'm';'-900 m' > + 'l';'2 ml' > + 'B';'9.24 GB' // let's handle some very small numbers> + 's''0.01 ys' > + 's''< -0.01 ys' > + 's''0.01 ys' > + 's''< 0.01 ys' // switch to verbose output> punitsverbose = true; > + 'meters';'9 kilometers' > + 'liter';'1 milliliter'