[Mono-bugs] [Bug 27849][Maj] New - jit math error

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
16 Jul 2002 16:31:43 -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 lupus@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=27849

--- shadow/27849	Tue Jul 16 12:31:43 2002
+++ shadow/27849.tmp.1561	Tue Jul 16 12:31:43 2002
@@ -0,0 +1,52 @@
+Bug#: 27849
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lupus@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: jit math error
+
+The following test gives the wrong result when run with the jit.
+The test needs to be compiled with mcs to show the bug.
+Set to Major because this happens a lot with the mcs-compiled corlib
+and generates exceptions in the lib because of the wrong value.
+using System;
+
+struct dt {
+	public const long TicksPerDay = 864000000000L;
+	public static double TotalDays
+	{
+		get
+		{
+			return (double) getit() / TicksPerDay;
+		}
+	}
+	public static int Days
+	{
+		get {
+			return (int) TotalDays;
+		}
+	}
+	static long getit () {
+		return 631624309901854540;
+	}
+	static int Main() {
+		int d = (int)((double)631624309901854540/TicksPerDay);
+		int d2 = Days;
+		Console.WriteLine ("c days: {0}", d);
+		Console.WriteLine ("d days: {0}", d2);
+		if (d != d2)
+			return 1;
+		return 0;
+	}
+}