Author: atsushi
Date: 2005-05-07 14:47:14 -0400 (Sat, 07 May 2005)
New Revision: 44203

Modified:
   trunk/mcs/class/corlib/System/ChangeLog
   trunk/mcs/class/corlib/System/NumberFormatter.cs
   trunk/mcs/class/corlib/Test/System/ChangeLog
   trunk/mcs/class/corlib/Test/System/DoubleTest.cs
Log:
2005-05-07  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * NumberFormatter.cs : roundtrip number is already rounded before
          FormatGeneral() and DefaultMaxPrecision was extraneous. This fixes
          bug #72955.

        * DoubleTest.cs : added test for #72955.



Modified: trunk/mcs/class/corlib/System/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System/ChangeLog     2005-05-07 17:49:05 UTC (rev 
44202)
+++ trunk/mcs/class/corlib/System/ChangeLog     2005-05-07 18:47:14 UTC (rev 
44203)
@@ -1,3 +1,9 @@
+2005-05-07  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * NumberFormatter.cs : roundtrip number is already rounded before
+         FormatGeneral() and DefaultMaxPrecision was extraneous. This fixes
+         bug #72955.
+
 2005-05-07  Ben Maurer  <[EMAIL PROTECTED]>
 
        * Array.cs (BinarySearch): Patch from kazuki to pass arguments to

Modified: trunk/mcs/class/corlib/System/NumberFormatter.cs
===================================================================
--- trunk/mcs/class/corlib/System/NumberFormatter.cs    2005-05-07 17:49:05 UTC 
(rev 44202)
+++ trunk/mcs/class/corlib/System/NumberFormatter.cs    2005-05-07 18:47:14 UTC 
(rev 44203)
@@ -145,7 +145,7 @@
                        case 'r':
                        case 'R':
                                if (ns.IsFloatingSource) {
-                                       return FormatGeneral (ns, 
ns.DefaultMaxPrecision, nfi, true);
+                                       return FormatGeneral (ns, 
ns.DefaultPrecision, nfi, true);
                                } else {
                                        throw new FormatException 
(Locale.GetText ("The specified format cannot be used in this instance"));
                                }
@@ -404,7 +404,7 @@
                {
                        return FormatGeneral (ns, -1, 
NumberFormatInfo.GetInstance (provider), true);
                }
-               internal static string FormatGeneral (NumberStore ns, int 
precision, NumberFormatInfo nfi, bool upper)
+               private static string FormatGeneral (NumberStore ns, int 
precision, NumberFormatInfo nfi, bool roundtrip)
                {
                        if (ns.ZeroOnly)
                                return "0";
@@ -432,7 +432,7 @@
                                        ns.Divide10 (1);
                                        exponent ++;
                                }
-                       } else {
+                       } else if (!roundtrip) {
                                ns.RoundDecimal (precision);
                        }
 
@@ -448,7 +448,7 @@
                        }
 
                        if (expMode) {
-                               if (upper)
+                               if (roundtrip)
                                        cb.Append ('E');
                                else
                                        cb.Append ('e');

Modified: trunk/mcs/class/corlib/Test/System/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System/ChangeLog        2005-05-07 17:49:05 UTC 
(rev 44202)
+++ trunk/mcs/class/corlib/Test/System/ChangeLog        2005-05-07 18:47:14 UTC 
(rev 44203)
@@ -1,3 +1,7 @@
+2005-05-07  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * DoubleTest.cs : added test for #72955.
+
 2005-05-07  Ben Maurer  <[EMAIL PROTECTED]>
 
        * ArrayTest.cs: Test for #70725.

Modified: trunk/mcs/class/corlib/Test/System/DoubleTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System/DoubleTest.cs    2005-05-07 17:49:05 UTC 
(rev 44202)
+++ trunk/mcs/class/corlib/Test/System/DoubleTest.cs    2005-05-07 18:47:14 UTC 
(rev 44203)
@@ -459,5 +459,13 @@
 
                        AssertEquals ("ToString(G)", "254.9", def);
                }
+
+               [Test]
+               public void LongLongValueRoundtrip ()
+               {
+                       // from bug #72955
+                       double d = 
0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000222;
+                       AssertEquals ("1.97626258336499E-323", d.ToString 
("R"));
+               }
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to