src/share/classes/sun/misc/FDBigInteger.java

Print this page
rev 7487 : 7192954: Fix Float.parseFloat to round correctly and preserve monotonicity.
4396272: Parsing doubles fails to follow IEEE for largest decimal that should yield 0
7039391: Use Math.ulp in FloatingDecimal
Summary: Correct rounding and monotonicity problems in floats and doubles
Reviewed-by: martin
Contributed-by: Dmitry Nadezhin <dmitry.nadezhin@oracle.com>, Louis Wasserman <lowasser@google.com>

@@ -780,11 +780,11 @@
      @*/
     public FDBigInteger leftInplaceSub(FDBigInteger subtrahend) {
         assert this.size() >= subtrahend.size() : "result should be positive";
         FDBigInteger minuend;
         if (this.isImmutable) {
-            minuend = new FDBigInteger(this.data, this.offset);
+            minuend = new FDBigInteger(this.data.clone(), this.offset);
         } else {
             minuend = this;
         }
         int offsetDiff = subtrahend.offset - minuend.offset;
         int[] sData = subtrahend.data;

@@ -849,11 +849,11 @@
      @*/
     public FDBigInteger rightInplaceSub(FDBigInteger subtrahend) {
         assert this.size() >= subtrahend.size() : "result should be positive";
         FDBigInteger minuend = this;
         if (subtrahend.isImmutable) {
-            subtrahend = new FDBigInteger(subtrahend.data, subtrahend.offset);
+            subtrahend = new FDBigInteger(subtrahend.data.clone(), subtrahend.offset);
         }
         int offsetDiff = minuend.offset - subtrahend.offset;
         int[] sData = subtrahend.data;
         int[] mData = minuend.data;
         int subLen = subtrahend.nWords;