Skip to content
This repository was archived by the owner on Oct 28, 2019. It is now read-only.

Commit 56878e2

Browse files
committed
fixed bug with calculating absolute from large values
1 parent 25720aa commit 56878e2

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

server.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ def handle(self):
111111
errors = 8
112112
elif operation == OPERATORS[7]:
113113
# unless the operation is abs or factorial
114-
if query.first > 0:
114+
if 0 < query.first < 21:
115115
result2 = factorial(query.first)
116116
else:
117117
errors = 6
118-
result = int(fabs(query.first))
118+
result = int(fabs(query.first))
119119

120120
# checking if result isn't too big or too small
121121
if result > MAX_INT:
@@ -149,20 +149,6 @@ def handle(self):
149149
result = 0
150150
result2 = 0
151151

152-
# elif errors == 7:
153-
# # division by 0
154-
# debugger(f"Error code:", errors)
155-
# status = errors
156-
# result = 0
157-
# result2 = 0
158-
#
159-
# elif errors == 8:
160-
# # logarithm
161-
# debugger(f"Error code:", errors)
162-
# status = errors
163-
# result = 0
164-
# result2 = 0
165-
166152
response = Turbo(operation, status, session_id, result, result2)
167153
debugger("Length of prepared response:", len(response.pack()))
168154
debugger("Response:", response.print())

0 commit comments

Comments
 (0)