commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r995988 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/DfpField.java
Date Fri, 10 Sep 2010 21:28:06 GMT
Author: luc
Date: Fri Sep 10 21:28:06 2010
New Revision: 995988

URL: http://svn.apache.org/viewvc?rev=995988&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/trunk/src/main/java/org/apache/commons/math/dfp/DfpField.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/DfpField.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/DfpField.java?rev=995988&r1=995987&r2=995988&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/DfpField.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/DfpField.java Fri
Sep 10 21:28:06 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