nicolargo/glances — pull request #218 by jrenner (2013-03-19 11:05:38+00:00)
Title: Tried to improve autoUnit

See issue #200

I think it is slightly better now, but I'm not sure.
Here are some test cases I made with [this](https://gist.github.com/jrenner/5195216#file-autounit_test-py) script:
You can see that at n < 100 it gets 1 decimal place, and at n < 10 it gets 2.
(Only for sizes > 1G)
```
CASE: 0 RESULT: 0
CASE: 56 RESULT: 56
CASE: 1555 RESULT: 2K
CASE: 12230 RESULT: 12K
CASE: 49727 RESULT: 49K
CASE: 2876895 RESULT: 3M
CASE: 59155253 RESULT: 56M
CASE: 378436614 RESULT: 361M
CASE: 6449649346 RESULT: 6.01G
CASE: 64000517022 RESULT: 59.6G
CASE: 478336670241 RESULT: 445G
CASE: 2880473564752 RESULT: 2.62T
CASE: 87823937829002 RESULT: 79.9T
CASE: 475325197443391 RESULT: 432T
CASE: 1587678425898748 RESULT: 1.41P
CASE: 73585938389646539 RESULT: 65.4P
CASE: 1106473456676292706 RESULT: 983P
CASE: 8913738729289388492 RESULT: 7.73E
CASE: 57347727765664511116 RESULT: 49.7E
CASE: 748671117638270442812 RESULT: 649E
CASE: 13451848263982169740709 RESULT: 11.4Z
CASE: 84492979559329757047141 RESULT: 71.6Z
CASE: 615665741451258991960706 RESULT: 521Z
CASE: 7855454286865834718780142 RESULT: 6.50Y

```