aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
Diffstat (limited to 'gn3')
-rw-r--r--gn3/api/search.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/gn3/api/search.py b/gn3/api/search.py
index 2c11d4c..820b74b 100644
--- a/gn3/api/search.py
+++ b/gn3/api/search.py
@@ -1,6 +1,7 @@
"""Search using Xapian index."""
from collections import namedtuple
+from decimal import Decimal
import gzip
import json
from functools import partial, reduce
@@ -151,7 +152,7 @@ def apply_si_suffix(location: str) -> int:
"""Apply SI suffixes kilo, mega, giga and convert to bases."""
suffixes = {"k": 3, "m": 6, "g": 9}
if location[-1] in suffixes:
- return int(float(location[:-1])*10**suffixes[location[-1].lower()])
+ return int(Decimal(location[:-1])*10**suffixes[location[-1].lower()])
else:
return int(location)