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 23:28:06 UTC
svn commit: r995988 -
/commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/DfpField.java
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);