Mercurial > ~darius > hgwebdir.cgi > pyinst
comparison misc.py @ 83:4cc3d0706dd1
Add suffixes down to atto
author | Daniel O'Connor <doconnor@gsoft.com.au> |
---|---|
date | Thu, 03 Oct 2024 08:56:07 +0930 |
parents | 47da95b31dcb |
children |
comparison
equal
deleted
inserted
replaced
82:6ce8ed5ba76d | 83:4cc3d0706dd1 |
---|---|
25 # SUCH DAMAGE. | 25 # SUCH DAMAGE. |
26 # | 26 # |
27 | 27 |
28 def sifmt(_v, dp = 3, unit = 'Hz', sp = ' '): | 28 def sifmt(_v, dp = 3, unit = 'Hz', sp = ' '): |
29 '''Format a number using SI prefixes''' | 29 '''Format a number using SI prefixes''' |
30 si_prefixes = ('T', 'G', 'M', 'k', '', 'm', 'µ', 'n', 'p') | 30 si_prefixes = ('T', 'G', 'M', 'k', '', 'm', 'µ', 'n', 'p', 'f', 'a') |
31 scale = 10 ** 12 | 31 scale = 10 ** 12 |
32 v = abs(_v) | 32 v = abs(_v) |
33 if v == 0: | 33 if v == 0: |
34 sip = "" | 34 sip = "" |
35 scale = 0 | 35 scale = 0 |