From c50e41dea1dc5aa9d0e2f5bec52c49039316daef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Tue, 17 Apr 2018 22:26:20 +0200 Subject: [PATCH] Numerical instability fix --- src/map/onlinemap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/map/onlinemap.cpp b/src/map/onlinemap.cpp index 97ee3c9b..5aeaa268 100644 --- a/src/map/onlinemap.cpp +++ b/src/map/onlinemap.cpp @@ -8,6 +8,7 @@ #define TILE_SIZE 256 +#define EPSILON 1e-6 static QPointF ll2m(const Coordinates &c) { @@ -36,7 +37,7 @@ static qreal zoom2scale(int zoom) static int scale2zoom(qreal scale) { - return (int)log2(360.0/(scale * (qreal)TILE_SIZE)); + return (int)(log2(360.0/(scale * (qreal)TILE_SIZE)) + EPSILON); }