mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-13 19:06:26 +00:00
8 lines
269 B
Python
8 lines
269 B
Python
|
from math import log, floor
|
||
|
|
||
|
def human_format(number):
|
||
|
units = ["", " Thousand", " Million", " Billion", " Trillion", " Quatrillion"]
|
||
|
k = 1000.0
|
||
|
magnitude = int(floor(log(number, k)))
|
||
|
return "%.2f%s" % (number / k ** magnitude, units[magnitude])
|