Loading cloudcontrol/cli/tagdisplay.py +10 −2 Original line number Diff line number Diff line Loading @@ -138,14 +138,22 @@ class TagDisplay(object): def type_bit(self, value): '''Bit type''' if value.isdecimal(): v = float(value) if value.startswith('-'): value_without_minus = value[1:] neg = True else: value_without_minus = value neg = False if value_without_minus.isdecimal(): v = float(value_without_minus) if v >= 1000: si = "KMGTPEZY" p = min(math.floor(math.log(abs(v), 2)/10.0), pow(2, len(si))) d = v / pow(2, 10*p) u = si[int(p-1)] value = u"%.4g%si"%(d, u) if neg: value = u"-" + value return value def type_second(self, value): Loading Loading
cloudcontrol/cli/tagdisplay.py +10 −2 Original line number Diff line number Diff line Loading @@ -138,14 +138,22 @@ class TagDisplay(object): def type_bit(self, value): '''Bit type''' if value.isdecimal(): v = float(value) if value.startswith('-'): value_without_minus = value[1:] neg = True else: value_without_minus = value neg = False if value_without_minus.isdecimal(): v = float(value_without_minus) if v >= 1000: si = "KMGTPEZY" p = min(math.floor(math.log(abs(v), 2)/10.0), pow(2, len(si))) d = v / pow(2, 10*p) u = si[int(p-1)] value = u"%.4g%si"%(d, u) if neg: value = u"-" + value return value def type_second(self, value): Loading