From fbfd7c3721f24d77744d1e92cf77f569b246c69d Mon Sep 17 00:00:00 2001 From: aristocratos Date: Sun, 20 Sep 2020 19:18:50 +0200 Subject: [PATCH] Fixed decimal placement in floating_humanizer() function --- bpytop.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bpytop.py b/bpytop.py index 90655b8..2a50943 100755 --- a/bpytop.py +++ b/bpytop.py @@ -4449,9 +4449,10 @@ def floating_humanizer(value: Union[float, int], bit: bool = False, per_second: break selector += 1 else: - if len(f'{value}') < 5 and len(f'{value}') >= 2 and selector > 0: - decimals = 5 - len(f'{value}') - out = f'{value}'[:-2] + "." + f'{value}'[-decimals:] + if len(f'{value}') == 4 and selector > 0: + out = f'{value}'[:-2] + "." + f'{value}'[-2] + elif len(f'{value}') == 3 and selector > 0: + out = f'{value}'[:-2] + "." + f'{value}'[-2:] elif len(f'{value}') >= 2: out = f'{value}'[:-2] else: