From 2e9f608a1b7b39bfed945c94de87c2bda696429a Mon Sep 17 00:00:00 2001 From: znuh Date: Sun, 31 Aug 2025 12:41:27 +0200 Subject: [PATCH] don't use floats for division because of rounding errors (see https://github.com/nzjrs/osm-gps-map/issues/101) --- src/osm-gps-map-widget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osm-gps-map-widget.c b/src/osm-gps-map-widget.c index e3158cd..5677843 100644 --- a/src/osm-gps-map-widget.c +++ b/src/osm-gps-map-widget.c @@ -1122,8 +1122,8 @@ osm_gps_map_fill_tiles_pixel (OsmGpsMap *map, cairo_t *cr) tiles_nx = (allocation.width - offset_x) / TILESIZE + 1; tiles_ny = (allocation.height - offset_y) / TILESIZE + 1; - tile_x0 = floorf((float)priv->map_x / (float)TILESIZE); - tile_y0 = floorf((float)priv->map_y / (float)TILESIZE); + tile_x0 = priv->map_x / TILESIZE; + tile_y0 = priv->map_y / TILESIZE; for (i=tile_x0; i<(tile_x0+tiles_nx);i++) {