Ignore:
Timestamp:
2015-05-17T15:52:24+02:00 (5 years ago)
Author:
Don-vip
Message:

squid:S1244 - Floating point numbers should not be tested for equality

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java

    r8378 r8384  
    232232        // center. This method is ok as long as distances are short
    233233        // relative to the distance from the N or S poles.
    234         if (radius == 0) {
     234        if (Double.doubleToRawLongBits(radius) == 0) {
    235235            for (Node n : nodes) {
    236236                radius += distance(center, n.getEastNorth());
  • trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java

    r8357 r8384  
    363363            b = xM - xB;
    364364            double norm = Math.sqrt(a*a + b*b);
    365             if (norm == 0)
     365            if (Double.doubleToRawLongBits(norm) == 0)
    366366                // Nodes have same coordinates !
    367367                throw new InvalidSelection();
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r8357 r8384  
    4646import org.openstreetmap.josm.tools.Pair;
    4747import org.openstreetmap.josm.tools.Shortcut;
     48import org.openstreetmap.josm.tools.Utils;
    4849
    4950/**
     
    357358                double candidateAngle = getAngle(headNode, candidatePrevNode, prevNode);
    358359
    359                 if(mostLeft == null || candidateAngle < angle || (candidateAngle == angle && !candidateComingToHead)) {
     360                if(mostLeft == null || candidateAngle < angle || (Utils.equalsEpsilon(candidateAngle, angle) && !candidateComingToHead)) {
    360361                    // Candidate is most left
    361362                    mostLeft = candidateWay;
  • trunk/src/org/openstreetmap/josm/actions/SelectByInternalPointAction.java

    r8338 r8384  
    6161                    EastNorth en2 = Main.map.mapView.getProjection().latlon2eastNorth(bBox.getBottomRight());
    6262                    double s = Math.abs((en1.east() - en2.east()) * (en1.north() - en2.north()));
    63                     if (s == 0) s = 1e8;
     63                    if (Double.doubleToRawLongBits(s) == 0) {
     64                        s = 1e8;
     65                    }
    6466                    found.put(s, r);
    6567                }
  • trunk/src/org/openstreetmap/josm/actions/audio/AudioPlayPauseAction.java

    r6830 r8384  
    1414import org.openstreetmap.josm.tools.AudioPlayer;
    1515import org.openstreetmap.josm.tools.Shortcut;
     16import org.openstreetmap.josm.tools.Utils;
    1617
    1718/**
     
    3839                AudioPlayer.play(url);
    3940            } else if (AudioPlayer.playing()){
    40                 if (AudioPlayer.speed() != 1.0)
     41                if (!Utils.equalsEpsilon(AudioPlayer.speed(), 1.0))
    4142                    AudioPlayer.play(url, AudioPlayer.position());
    4243                else
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r8378 r8384  
    10051005            // In practice this will probably only happen when a way has been duplicated
    10061006
    1007             if (u == 0)
     1007            if (Double.doubleToRawLongBits(u) == 0)
    10081008                return;
    10091009
  • trunk/src/org/openstreetmap/josm/actions/mapmode/PlayHeadDragMode.java

    r8308 r8384  
    6060            dragging = true;
    6161        }
    62         if (p.distance(mousePos) == 0) return;
     62        if (Double.doubleToRawLongBits(p.distance(mousePos)) == 0) return;
    6363        playHeadMarker.drag(Main.map.mapView.getEastNorth(ev.getX(), ev.getY()));
    6464        mousePos = p;
Note: See TracChangeset for help on using the changeset viewer.