Module: check_mk
Branch: master
Commit: 009cfa953fead8eb5bde7aacb20fc931ad23fe4e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=009cfa953fead8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 16 17:10:48 2018 +0100
Removed unused render_float_with_precision()
Change-Id: Ib093724116888b79136d1d105700692113f01441
---
web/htdocs/lib.py | 30 ------------------------------
1 file changed, 30 deletions(-)
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index e8620c5..984aeff 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -337,36 +337,6 @@ def drop_dotzero(v, digits=2):
return t
-# Renders a floating point number with the given number
-# of non-zero digits. Example if precision is 3:
-# 12.40349034 -> 12.4
-# 1.23894859348563478 -> 1.24
-# 0.00001239898568978 -> 0.0000124
-# 12400000.00230923 -> 12400000
-
-def render_float_with_precision(value, precision):
- if value == 0:
- return "0"
-
- elif value < 0:
- return "-" + render_float_with_precision(-value, precision)
-
- mantissa, exponent = frexp10(float(value))
- # exponent + 1 is the number of digits left of the .
-
- # Digits left of . are more than precision -> no fraction.
- if exponent + 1 >= precision:
- return "%.0f" % value
-
- # Allow so many digits after comma that we have at least 'precision'
- # valid non-zero digits
- else:
- digits = precision - exponent - 1
- return "%%.%df" % digits % value
-
-
-
-
def number_human_readable(n, precision=1, unit="B"):
base = 1024.0
if unit == "Bit":