[Mono-bugs] [Bug 71286][Nor] New - Double formating error.
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 14 Jan 2005 17:32:02 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by miguel@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=71286
--- shadow/71286 2005-01-14 17:32:02.000000000 -0500
+++ shadow/71286.tmp.12339 2005-01-14 17:32:02.000000000 -0500
@@ -0,0 +1,119 @@
+Bug#: 71286
+Product: Mono: Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: miguel@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Double formating error.
+
+The following program should work, fails in both cases.
+
+This is taken from our NUnit tests (corlib/System/DoubleFormatterTest.cs)
+and is currently disabled.
+
+using System.Globalization;
+using System;
+
+class X {
+ static private NumberFormatInfo GetNumberFormat1()
+ {
+ NumberFormatInfo format = new NumberFormatInfo();
+
+ format.NaNSymbol = "NaN";
+ format.PositiveSign = "+";
+ format.NegativeSign = "-";
+ format.PerMilleSymbol = "x";
+ format.PositiveInfinitySymbol = "Infinity";
+ format.NegativeInfinitySymbol = "-Infinity";
+
+ format.NumberDecimalDigits = 5;
+ format.NumberDecimalSeparator = ",";
+ format.NumberGroupSeparator = ".";
+ format.NumberGroupSizes = new int[] {3};
+ format.NumberNegativePattern = 2;
+
+ format.CurrencyDecimalDigits = 2;
+ format.CurrencyDecimalSeparator = ",";
+ format.CurrencyGroupSeparator = ".";
+ format.CurrencyGroupSizes = new int[] {3};
+ format.CurrencyNegativePattern = 8;
+ format.CurrencyPositivePattern = 3;
+ format.CurrencySymbol = "EUR";
+
+ format.PercentDecimalDigits = 5;
+ format.PercentDecimalSeparator = ",";
+ format.PercentGroupSeparator = ".";
+ format.PercentGroupSizes = new int[] {3};
+ format.PercentNegativePattern = 0;
+ format.PercentPositivePattern = 0;
+ format.PercentSymbol = "%";
+
+ return format;
+ }
+
+ static private NumberFormatInfo GetNumberFormat2()
+ {
+ NumberFormatInfo format = new NumberFormatInfo();
+
+ format.NaNSymbol = "Geen";
+ format.PositiveSign = "+";
+ format.NegativeSign = "-";
+ format.PerMilleSymbol = "x";
+ format.PositiveInfinitySymbol = "Oneindig";
+ format.NegativeInfinitySymbol = "-Oneindig";
+
+ format.NumberDecimalDigits = 2;
+ format.NumberDecimalSeparator = ".";
+ format.NumberGroupSeparator = ",";
+ format.NumberGroupSizes = new int[] {3};
+ format.NumberNegativePattern = 1;
+
+ format.CurrencyDecimalDigits = 1;
+ format.CurrencyDecimalSeparator = ".";
+ format.CurrencyGroupSeparator = ",";
+ format.CurrencyGroupSizes = new int[] {3};
+ format.CurrencyNegativePattern = 3;
+ format.CurrencyPositivePattern = 1;
+ format.CurrencySymbol = "$";
+
+ format.PercentDecimalDigits = 2;
+ format.PercentDecimalSeparator = ".";
+ format.PercentGroupSeparator = ",";
+ format.PercentGroupSizes = new int[] {3};
+ format.PercentNegativePattern = 1;
+ format.PercentPositivePattern = 2;
+ format.PercentSymbol = "##";
+
+ return format;
+ }
+ static void FormatStringTest(string TestNumber, NumberFormatInfo
+NumberFormat, double Number, string Format, string ExpectedResult)
+ {
+ if (ExpectedResult != Number.ToString(Format, NumberFormat))
+ Console.WriteLine ("Failed: " + TestNumber);
+ }
+
+ static void Main ()
+ {
+ NumberFormatInfo NumberFormat;
+
+ NumberFormat = GetNumberFormat1();
+ FormatStringTest ("DblFn1 #15", NumberFormat, 99999.9999996, "E67",
+"9,9999999999599997000000000000000000000000000000000000000000000000000E+004");
+
+ NumberFormat = GetNumberFormat2();
+ FormatStringTest ("DblFn2 #15", NumberFormat, 99999.9999996, "E67",
+"9.9999999999599997000000000000000000000000000000000000000000000000000E+004");
+
+ }
+}