fixed negative zero displayed in format_binomial_conf by using proper rounding functions
authorForrest Voight <forrest@forre.st>
Thu, 9 Feb 2012 20:47:23 +0000 (15:47 -0500)
committerForrest Voight <forrest@forre.st>
Thu, 9 Feb 2012 20:49:55 +0000 (15:49 -0500)
p2pool/util/math.py

index 9268e57..8e73e3c 100644 (file)
@@ -158,7 +158,7 @@ def format_binomial_conf(x, n, conf=0.95, f=lambda x: x):
     if n == 0:
         return '???'
     left, right = minmax(map(f, binomial_conf_interval(x, n, conf)))
-    return '~%.1f%% (%.f-%.f%%)' % (100*f(x/n), 100*left-1/2, 100*right+1/2)
+    return '~%.1f%% (%.f-%.f%%)' % (100*f(x/n), math.floor(100*left), math.ceil(100*right))
 
 def reversed(x):
     try: