From a9c011099b9e5fcf66dde8f4ceb87ac90838aa7b Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 24 Jan 2023 18:59:24 +0000 Subject: search: Use decimals, not floats, when converting to megabases. * gn3/api/search.py (parse_location_field): Use decimals, not floats, when converting to megabases. --- gn3/api/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/api/search.py b/gn3/api/search.py index 328baf5..aa844ee 100644 --- a/gn3/api/search.py +++ b/gn3/api/search.py @@ -176,7 +176,7 @@ def parse_location_field(species_query: xapian.Query, def make_query(interval: ChromosomalInterval) -> xapian.Query: # TODO: Convert the xapian index to use bases instead of megabases. - to_megabases = lambda x: str(float(x)/1e6) + to_megabases = lambda x: str(Decimal(x)/10**6) return combine_queries(xapian.Query.OP_AND, species_query, xapian.Query(chromosome_prefix + interval.chromosome), -- cgit v1.2.3