sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1535062 - /sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
Date Wed, 23 Oct 2013 15:28:23 GMT
Author: desruisseaux
Date: Wed Oct 23 15:28:22 2013
New Revision: 1535062

URL: http://svn.apache.org/r1535062
Log:
More conservative fix for rounding errors: round to exactly the number of digits to be formatted,
no more.

Modified:
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java?rev=1535062&r1=1535061&r2=1535062&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
[UTF-8] Wed Oct 23 15:28:22 2013
@@ -922,9 +922,9 @@ public class AngleFormat extends Format 
              * 2 to base 10.
              */
             final int n = fractionDigitsForDelta(Math.ulp(angle) * (secondsFieldWidth ==
0 ? 60 : 3600), false);
-            final double p = pow10(Math.max(1, Math.min(maximumFractionDigits, n)));
             maximumFractionDigits = Math.max(minimumFractionDigits,
                                     Math.min(maximumFractionDigits, n - 1));
+            final double p = pow10(maximumFractionDigits);
             if (secondsFieldWidth != 0) {
                 seconds = (minutes - (minutes = truncate(minutes))) * 60;
                 seconds = rint(seconds * p) / p; // Correction for rounding errors.



Mime
View raw message