Opened 3 years ago
Closed 3 years ago
#21646 closed defect (fixed)
[PATCH][RFC] Round new points in org.openstreetmap.josm.data.imagery.Shape or modify equals
Reported by: | taylor.smock | Owned by: | Don-vip |
---|---|---|---|
Priority: | normal | Milestone: | 21.12 |
Component: | Core imagery | Version: | |
Keywords: | Cc: |
Description
This is one of those "fun" double things.
The double representation of 0.2575799 * 1e7
is 2575798.9999999995
. Directly casting to int will round down to 2575798
. This particular number can be found in the boundaries.osm file used for Territories.
See (9.42696, 0.2575799) (this is on the border between Ghana and Togo).
Right now, neither Togo nor Ghana has any national imagery layers. However, if they existed, they would always be reset/updated, as the comparison between the "default" and the "changed" ImageryInfo would always fail.
Solutions:
1) When checking equality using equalsPref
, when comparing bounds/bound shapes, use Utils.equalsEpsilon
2) Correct for double issues by rounding then casting to int
Attachments (2)
Change History (4)
by , 3 years ago
Attachment: | 21646.round.patch added |
---|
by , 3 years ago
Attachment: | 21646.equality.patch added |
---|
Modify equality to use MAX_SERVER_PRECISION as epsilon for coordinate differences
comment:1 by , 3 years ago
Component: | Core → Core imagery |
---|---|
Milestone: | → 21.12 |
Owner: | changed from | to
Status: | new → assigned |
Round on coordinate add