@unwrap<EOL>def business(values, precision=<NUM_LIT:3>, prefix=True, prefixes=SI, statistic=median, default='<STR_LIT>'):
reference = statistic(values)<EOL>if not reference:<EOL><INDENT>return upcast(['<STR_LIT>'] * len(values), values)<EOL><DEDENT>exponent = order(reference)<EOL>e = bound(exponent - exponent % <NUM_LIT:3>, -<NUM_LIT:12>, <NUM_LIT:12>)<EOL>d = precision - (<NUM_LIT:1> + exponent - e)<EOL>prefix = prefixes[e]<EOL>strings = []<EOL>for value in values:<EOL><INDENT>if isnan(value):<EOL><INDENT>strings.append('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>normalized = value / <NUM_LIT> ** e<EOL>relative_order = order(value) - exponent<EOL>places = min(d - relative_order, d)<EOL>normalized = round(normalized, places)<EOL>strings.append('<STR_LIT>'.format(normalized, d) + prefix)<EOL><DEDENT><DEDENT>return upcast(strings, values)<EOL>
Convert a list of numbers to the engineering notation appropriate to a
reference point like the minimum, the median or the mean --
think of it as "business notation".

Any number will have at most the amount of significant digits of the
reference point, that is, the function will round beyond the
decimal point.

For example, if the reference is `233K`, this function will turn
1,175,125 into `1180K` and 11,234 into `11K` (instead of 1175K and
11.2K respectively.) This can help enormously with readability.

If the reference point is equal to or larger than E15 or
equal to or smaller than E-15, E12 and E-12 become the
reference point instead. (Petas and femtos are too
unfamiliar to people to be easily comprehended.)