commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r995965 - /commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/dfp/DfpField.java
Date Fri, 10 Sep 2010 20:24:54 GMT
Author: luc
Date: Fri Sep 10 20:24:54 2010
New Revision: 995965

URL: http://svn.apache.org/viewvc?rev=995965&view=rev
Log:
prevent DfpField radix digit to be smaller than 4 as it created problem when converting to
double
(we need to be able to create a Dfp with value 2^52 which needs 16 decimal digits or 4 radix
digits)

Modified:
    commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/dfp/DfpField.java

Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/dfp/DfpField.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/dfp/DfpField.java?rev=995965&r1=995964&r2=995965&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/dfp/DfpField.java
(original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/dfp/DfpField.java
Fri Sep 10 20:24:54 2010
@@ -187,7 +187,7 @@ public class DfpField implements Field<D
      */
     public DfpField(final int decimalDigits, final boolean computeConstants) {
 
-        this.radixDigits = (decimalDigits + 3) / 4;
+        this.radixDigits = (decimalDigits < 13) ? 4 : (decimalDigits + 3) / 4;
         this.rMode       = RoundingMode.ROUND_HALF_EVEN;
         this.ieeeFlags   = 0;
         this.zero        = new Dfp(this, 0);



Mime
View raw message