[Mono-bugs] [Bug 79414][Maj] New - float and double do not multiply properly

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Sep 15 18:19:55 EDT 2006


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 ximian.bugzilla at analogcoast.com.

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

--- shadow/79414	2006-09-15 18:19:55.000000000 -0400
+++ shadow/79414.tmp.13955	2006-09-15 18:19:55.000000000 -0400
@@ -0,0 +1,75 @@
+Bug#: 79414
+Product: Mono: Runtime
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: Gentoo 2.6.15
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: ximian.bugzilla at analogcoast.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: float and double do not multiply properly
+
+Description of Problem:
+
+Float and Double types do not roundtrip well when doing simple math
+
+Steps to reproduce the problem:
+
+Run code below: 
+
+using System;
+using System.Collections;
+
+public class MyClass
+{
+	public static void Main()
+	{
+		int bad = 0;
+		
+        float d;
+        for (int i = 0; i < 100000; i++)
+		{
+		    d = (float)i / 100;
+		    d *= 100;
+			
+			if (d != i)
+			{
+				WL(i);
+				bad++;
+			}
+		}
+
+		WL("Done. " + bad.ToString());
+		RL();
+	}
+	
+	#region Helper methods
+
+	private static void WL(object text, params object[] args)
+	{
+		Console.WriteLine(text.ToString(), args);	
+	}
+	
+	private static void RL()
+	{
+		Console.ReadLine();	
+	}
+	
+	#endregion
+}
+
+Actual Results: list of 9173 numbers that oddly stops at 65533 with message
+"Done 9173"
+
+Expected Results: Result message of "Done. 0"
+
+How often does this happen? Every time. 
+
+Additional Information: This also affects double type.


More information about the mono-bugs mailing list