Changeset 15036 in josm


Ignore:
Timestamp:
2019-05-02T08:54:58+02:00 (7 months ago)
Author:
GerdP
Message:

see #17616: fix findbugs issues FE_FLOATING_POINT_EQUALITY

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r15035 r15036  
    11561156            double distance = getDistance(osm, primitive);
    11571157            if (Double.isNaN(distance)) continue;
    1158             if (distance < lowestDistance) {
     1158            int comp = Double.compare(distance, lowestDistance);
     1159            if (comp < 0) {
    11591160                closest.clear();
    11601161                lowestDistance = distance;
    11611162                closest.add(primitive);
    1162             } else if (distance == lowestDistance) {
     1163            } else if (comp == 0) {
    11631164                closest.add(primitive);
    11641165            }
     
    12191220            double distance = getDistance(osm, primitive);
    12201221            if (Double.isNaN(distance)) continue;
    1221             if (distance > furthestDistance) {
     1222            int comp = Double.compare(distance, furthestDistance);
     1223            if (comp > 0) {
    12221224                furthest.clear();
    12231225                furthestDistance = distance;
    12241226                furthest.add(primitive);
    1225             } else if (distance == furthestDistance) {
     1227            } else if (comp == 0) {
    12261228                furthest.add(primitive);
    12271229            }
Note: See TracChangeset for help on using the changeset viewer.