mirror of
https://github.com/Redume/Shirino.git
synced 2024-11-21 15:56:22 +03:00
Rounding instead of flooring
This commit is contained in:
parent
63bd0bf421
commit
2573253e2b
1 changed files with 4 additions and 6 deletions
10
main.py
10
main.py
|
@ -93,13 +93,11 @@ class CurrencyConverter:
|
||||||
# it is an integer like 81.0
|
# it is an integer like 81.0
|
||||||
return
|
return
|
||||||
|
|
||||||
# first non-zero +
|
# how many digits should be after the point:
|
||||||
# 3 digits after zeroes or after the point
|
# ndigits (3 by default) after first non-zero
|
||||||
# (settings.ndigit = 3 by default)
|
ndigits = fnz + settings.ndigits
|
||||||
after_point = after_point[:fnz + settings.ndigits]
|
|
||||||
|
|
||||||
rounded = f'{str_amount[:point]}.{after_point}'
|
self.conv_amount = round(self.conv_amount, ndigits)
|
||||||
self.conv_amount = float(rounded)
|
|
||||||
|
|
||||||
def ddgapi(self) -> bool:
|
def ddgapi(self) -> bool:
|
||||||
"""Get data from DuckDuckGo's currency API
|
"""Get data from DuckDuckGo's currency API
|
||||||
|
|
Loading…
Add table
Reference in a new issue