Don’t use single letter variable names

Better to call the variables what they are.

Also re-orders the statement to avoid adding to a negative number.
This commit is contained in:
Chris Hill-Scott
2020-09-16 08:25:42 +01:00
parent ce35200453
commit 6b7908fecb

View File

@@ -16,10 +16,10 @@ from app.notify_client.broadcast_message_api_client import (
from app.notify_client.service_api_client import service_api_client
def round_to_significant_figures(x, n):
def round_to_significant_figures(value, number_of_significant_figures):
return int(round(
x,
-int(floor(log10(abs(x)))) + (n - 1)
value,
number_of_significant_figures - int(floor(log10(abs(value)))) - 1
))