From f1feb772d782708b2114a1cb4b529775853e7dd4 Mon Sep 17 00:00:00 2001 From: ramandel Date: Tue, 16 Sep 2014 11:51:20 -0700 Subject: [PATCH] Update util.py Changed line 41 so that the logarithmic change to base 1000 formula uses log base 10 instead of natural log. this allows the denominator to be simplified to 3. Also got rid of the use of floor() inside of int() because it is redundant. --- pygal/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygal/util.py b/pygal/util.py index 3b0effd..7fd1884 100644 --- a/pygal/util.py +++ b/pygal/util.py @@ -38,7 +38,7 @@ def float_format(number): def humanize(number): """Format a number to engineer scale""" - order = number and int(floor(log(abs(number)) / log(1000))) + order = number and int(log10(abs(number)) / 3.0) human_readable = ORDERS.split(" ")[int(order > 0)] if order == 0 or order > len(human_readable): return float_format(number / (1000 ** int(order)))