[Mono-bugs] [Bug 26056] New - decimal2string rounds differently than MS.NET
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
10 Jun 2002 14:39:56 -0000
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 ndrochak@gol.com.
http://bugzilla.ximian.com/show_bug.cgi?id=26056
--- shadow/26056 Mon Jun 10 10:39:56 2002
+++ shadow/26056.tmp.15202 Mon Jun 10 10:39:56 2002
@@ -0,0 +1,42 @@
+Bug#: 26056
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 7.2
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: ndrochak@gol.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: decimal2string rounds differently than MS.NET
+
+The following sample program highlights the problem. MS.NET rounds the
+value "up" whereas mono is rounding it "down".
+-------------------------------------------------------------
+using System;
+using System.Globalization;
+
+class Class1 {
+ static int Main(string[] args)
+ {
+ string expected_value = "1,234.8977";
+ NumberFormatInfo NfiUser;
+ NfiUser = new NumberFormatInfo();
+ NfiUser.NumberDecimalDigits = 4;
+ Decimal d = 1234.89765m;
+ if (d.ToString("N", NfiUser) == expected_value){
+ return 0;
+ }
+ else {
+ Console.WriteLine("Expected <{0}> but got <{1}>",
+expected_value, d.ToString("N", NfiUser));
+ return 1;
+ }
+ }
+}