[Mono-bugs] [Bug 23960] New - Bug in Math.Round
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
28 Apr 2002 00:41:23 -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 totte@labs2.com.
http://bugzilla.ximian.com/show_bug.cgi?id=23960
--- shadow/23960 Sat Apr 27 20:41:23 2002
+++ shadow/23960.tmp.21099 Sat Apr 27 20:41:23 2002
@@ -0,0 +1,55 @@
+Bug#: 23960
+Product: Mono/Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: System
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: totte@labs2.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Bug in Math.Round
+
+Math.Round is broken when called for negative numbers.
+
+This example code show the problem :
+
+using System;
+
+class StringTest
+{
+ static void Main(string[] args)
+ {
+ double test = 2.510;
+ Console.WriteLine("{0}", Math.Round(test));
+ test = 2.490;
+ Console.WriteLine("{0}", Math.Round(test));
+
+ test = -2.510;
+ Console.WriteLine("{0}", Math.Round(test));
+ test = -2.490;
+ Console.WriteLine("{0}", Math.Round(test));
+ }
+}
+
+Should return :
+
+3
+2
+-3
+-2
+
+but with our corlib it gets:
+
+3.0000000
+2.0000000
+-2.0000000
+-2.0000000
+
+(Note that our lib also has different default formating)