Skip to content

Commit c378923

Browse files
committed
Fix format with worng mean round, fixes #4
1 parent 4e956c8 commit c378923

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

labfis/main.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ def format(self):
5959
else:
6060
r = -i
6161
r += 1
62-
for digit in su:
63-
if digit == "0":
62+
for j in range(len(su)):
63+
if su[j] == "0":
6464
r += 1
65-
elif digit != ".":
65+
elif su[j+1] == "9" and r > 0:
66+
m = round(self.mean, r-1)
67+
u = round(self.uncertainty, r)
68+
return((m,u))
69+
elif su[j] != ".":
6670
m = round(self.mean, r)
6771
u = round(self.uncertainty, r)
6872
return((m,u))

0 commit comments

Comments
 (0)