You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2010/09/10 22:24:54 UTC

svn commit: r995965 - /commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/dfp/DfpField.java

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);