Skip to content

Incorrect end distance #463

@jcoupey

Description

@jcoupey

I spotted an edge case where the accumulated distance provided for the end step is slightly off. If the previous step right before the end of route is a break and there is no travel time left between break and end, then we may return an accumulated distance for the end that is lower by 1m than the accumulated distance at the previous break step (and the total distance for the route).

This is due to the fact that the total distance is a double and it can get truncated here:

// Unchanged distance after last non-break step.
for (auto i = steps_rank; i < route.steps.size(); ++i) {
route.steps[i].distance = sum_distance;
}

whereas all other distances are properly rounded.

Also I have a feeling that this last loop could probably be avoided or simplified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions