diff artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java @ 9367:8aa1605e58f1

Fixed: rounding methods NaN aware in Formatter
author mschaefer
date Thu, 02 Aug 2018 16:08:51 +0200
parents 5e38e2924c07
children
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java	Thu Aug 02 15:06:22 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java	Thu Aug 02 16:08:51 2018 +0200
@@ -58,11 +58,12 @@
     }
 
     public static final double round(double x, double precision) {
+        // REMARK/FIXME: Gives 0 for NaN - is this intended?
         return Math.round(x * precision)/precision;
     }
 
     public static final double round(double x) {
-        return Math.round(x * DEFAULT_STEP_PRECISION)/DEFAULT_STEP_PRECISION;
+        return round(x, DEFAULT_STEP_PRECISION);
     }
 
     /**

http://dive4elements.wald.intevation.org