[Mono-bugs] [Bug 59425][Nor] New - Decimal.ToString() minor formatting bug in MONO Beta 1&2
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 1 Jun 2004 21:16:42 -0400 (EDT)
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 davidandrewtaylor@hotmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=59425
--- shadow/59425 2004-06-01 21:16:41.000000000 -0400
+++ shadow/59425.tmp.2431 2004-06-01 21:16:41.000000000 -0400
@@ -0,0 +1,67 @@
+Bug#: 59425
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details:
+Status: NEW
+Resolution:
+Severity: 001 One hour
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: davidandrewtaylor@hotmail.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Decimal.ToString() minor formatting bug in MONO Beta 1&2
+
+Description of Problem:
+I found a slight inconsistency (that I will call a bug) when using MONO
+when calling .ToString() on a Decimal type. While both MS.NET and MONO
+output 0 as "0", and 5.37 as "5.37" the inconsistency is for exact
+numbers (integers). So for all exact numbers other than 0, such as 1 or
+2 or 3, MS.NET will output "1.00", "2.00", "3.00" whist MONO will
+output "1", "2", "3".
+
+I realize this is minor but it did cause a problem in a few of my web
+apps where I was doing regular expression validation requiring the X.YY
+format, thus each time the user tried to edit the value they had to
+append the ".00".
+
+It would be great to be consistent with MS.NET with this without
+requiring a special string formatter, etc.
+
+Steps to reproduce the problem:
+1. Run this program:
+
+using System;
+public class test
+{
+ static void Main()
+ {
+ Decimal num = 5.00M;
+ Console.WriteLine("5.00 : " + num); // Here is the inconsistency
+ num = 5.37M;
+ Console.WriteLine("5.37 : " + num);
+ num = 0.00M;
+ Console.WriteLine("0.00 : " + num);
+ }
+}
+
+Actual Results:
+Results producted by MONO Beta 1&2:
+5.00 : 5
+5.37 : 5.37
+0.00 : 0
+
+Expected Results:
+Should be same an MS.NET 1.1:
+5.00 : 5.00
+5.37 : 5.37
+0.00 : 0
+
+How often does this happen?
+All the time on MONO Beta 1&2
+
+Additional Information: