Index: trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/coor/LatLon.java	(revision 4540)
+++ trunk/src/org/openstreetmap/josm/data/coor/LatLon.java	(revision 4541)
@@ -12,4 +12,6 @@
 import static java.lang.Math.toRadians;
 
+import java.math.BigDecimal;
+import java.math.MathContext;
 import java.text.DecimalFormat;
 import java.text.NumberFormat;
@@ -28,4 +30,5 @@
 public class LatLon extends Coordinate {
 
+    
     /**
      * Minimum difference in location to not be represented as the same position.
@@ -33,4 +36,5 @@
      */
     public static final double MAX_SERVER_PRECISION = 1e-7;
+    public static final int    MAX_SERVER_DIGITS = 7;
 
     private static DecimalFormat cDmsMinuteFormatter = new DecimalFormat("00");
@@ -240,5 +244,8 @@
      */
     public static double roundToOsmPrecision(double value) {
-        return Math.round(value / MAX_SERVER_PRECISION) * MAX_SERVER_PRECISION;
+        double absV = Math.abs(value);
+        int numOfDigits = MAX_SERVER_DIGITS + (absV < 1 ? 0 : (absV < 10 ? 1 : (absV < 100 ? 2 : 3))); 
+        return BigDecimal.valueOf(value).round(new MathContext(numOfDigits)).doubleValue();
+        //return Math.round(value / MAX_SERVER_PRECISION) * MAX_SERVER_PRECISION; // Old method, causes rounding errors (see LatLonTest) !
     }
     
