2004-06-18 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Thu, 17 Jun 2004 18:46:45 +0000 (18:46 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Thu, 17 Jun 2004 18:46:45 +0000 (18:46 -0000)
* SqlMoney.cs: Removed old "hack" to correct scale after rounding as
Decimal has been fixed (in fact this code was moved and adapted for
Decimal as it was better than the previous fix).

svn path=/trunk/mcs/; revision=29802

mcs/class/System.Data/System.Data.SqlTypes/ChangeLog
mcs/class/System.Data/System.Data.SqlTypes/SqlMoney.cs

index d8c54ca7b65c601012da2f5f1f3dad8548d0f5c9..795093950e9e065a289c40f9c322746a995cd67c 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-18  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * SqlMoney.cs: Removed old "hack" to correct scale after rounding as
+       Decimal has been fixed (in fact this code was moved and adapted for
+       Decimal as it was better than the previous fix).
+
 2004-06-08 Umadevi S <sumadevi@novell.com>
        * SqlGuid.cs - fixed bug 59420. Implemented CompareTo according to MSDN documenation
 
index ce203d752df2f5d8614bd9b1142d62b5d8dccfb0..b92a09612eca67412d99004b5582f95d54b658b5 100644 (file)
@@ -57,23 +57,7 @@ namespace System.Data.SqlTypes
                {
                        if (value > 922337203685477.5807m || value < -922337203685477.5808m)
                                throw new OverflowException ();
-
-                       value = Decimal.Round (value, 4);
-
-                       int [] bits = Decimal.GetBits (value);
-                       int scaleDiff = 4 - ((bits [3] & 0x7FFF0000) >> 16);
-                       decimal tmp = value;
-                       // integrify
-                       if (scaleDiff > 0)
-                               for (int i = 0; i < scaleDiff; i++)
-                                       tmp *= 10;
-                       else if (scaleDiff < 0)
-                               for (int i = 0; i > scaleDiff; i--)
-                                       tmp /= 10;
-                       int [] tmpbits = decimal.GetBits (tmp);
-                       tmpbits [3] = (value < 0) ? 0x8004 << 16 : 0x40000;
-                       this.value = new decimal (tmpbits);
-
+                       this.value = Decimal.Round (value, 4);
                        notNull = true;
                }