Round up in GeoCoordinateFormatter when close to a degree/minute #93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm introducing a delta here.
This compensates for all kinds of rounding errors that can happen when the precision is calculated externally.
I consider this a bugfix because it changes the output of the formatter to be much closer to the users expectation. When the precision is 0.999° it is very surprising to get 1°59'. This makes it look like the precision is 1 second, when in reality it is almost exactly 1 minute.
I was playing around with different thresholds. Note that 30 seconds is a bad threshold. It appears like this will create a situation where the distance to 1 minute is the same as the distance to 1 second. In reality the threshold represents 0.5 minutes, but 30 seconds (2 vs. 30 times).
A perfect threshold would be the square root of 60 = 7.746 seconds, but that would be confusing for users. 10 seconds (represents an actual digit in the output format) would be to much. Something like 5 or 2 seconds would be ok but still be confusing. So I decided to go for 1.
Bug: T158772