# HG changeset patch # User Sascha L. Teichmann # Date 1306402917 0 # Node ID d8c47520c7265a99245622d482b0a7ce3f7d4248 # Parent d08f77e7f7e8f5ed164582ee7cc492007b7db8ca Round exploded values to a precision of 1e-6. flys-artifacts/trunk@2008 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r d08f77e7f7e8 -r d8c47520c726 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed May 25 15:31:25 2011 +0000 +++ b/flys-artifacts/ChangeLog Thu May 26 09:41:57 2011 +0000 @@ -1,3 +1,8 @@ +2011-05-26 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: + Round exploded values to a precision of 1e-6. + 2011-05-25 Sascha L. Teichmann Qs are now stored in ranges for each column. diff -r d08f77e7f7e8 -r d8c47520c726 flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Wed May 25 15:31:25 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Thu May 26 09:41:57 2011 +0000 @@ -74,6 +74,8 @@ /** The default step width between the start end end kilometer.*/ public static final double DEFAULT_KM_STEPS = 0.1; + public static final double DEFAULT_PRECISION = 1e6; + /** The identifier of the current state. */ protected String currentStateId; @@ -906,7 +908,20 @@ * * @return an array of double values. */ - public static double[] getExplodedValues(double from, double to, double step) { + public static double[] getExplodedValues( + double from, + double to, + double step + ) { + return getExplodedValues(from, to, step, DEFAULT_PRECISION); + } + + public static double[] getExplodedValues( + double from, + double to, + double step, + double precision + ) { double lower = from; double diff = to - from; @@ -916,7 +931,7 @@ double [] values = new double[num]; for (int idx = 0; idx < num; idx++) { - values[idx] = lower; + values[idx] = Math.round(lower * precision)/precision; lower += step; }