From 95a584a30dd3d6682c0231665d51c14938d5be54 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Wed, 16 Nov 2016 00:05:08 +0000 Subject: [PATCH] Make rounding when computing PhantomNode weight symmetric Resolves a problem where the duration in forward and backward direction was slightly different. --- include/engine/geospatial_query.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/engine/geospatial_query.hpp b/include/engine/geospatial_query.hpp index 9470522ff..cf27b2604 100644 --- a/include/engine/geospatial_query.hpp +++ b/include/engine/geospatial_query.hpp @@ -400,7 +400,8 @@ template class GeospatialQuery } if (data.reverse_segment_id.id != SPECIAL_SEGMENTID) { - reverse_weight *= 1.0 - ratio; + const EdgeWeight difference = reverse_weight * ratio; + reverse_weight -= difference; } auto transformed = PhantomNodeWithDistance{PhantomNode{data,