[Mono-bugs] [Bug 25682] New - Casting longs to doubles lose precision
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
3 Jun 2002 02:40:07 -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 duncan@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=25682
--- shadow/25682 Sun Jun 2 22:40:07 2002
+++ shadow/25682.tmp.16871 Sun Jun 2 22:40:07 2002
@@ -0,0 +1,49 @@
+Bug#: 25682
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: duncan@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Casting longs to doubles lose precision
+
+Description of Problem:
+Casting longs to doubles lose precision. This is causing a bug in one of
+the tests for System.Convert.
+
+Steps to reproduce the problem:
+This is the test case:
+class X {
+ static void Main ()
+ {
+ long max = Int64.MaxValue;
+ max += 1;
+ double d = (double) max;
+
+ Console.WriteLine ("max is " + max);
+ Console.WriteLine ("d is " + d);
+ Console.WriteLine ("Int64.MinValue: " + Int64.MinValue);
+ Console.WriteLine ("Int64.MaxValue: " + Int64.MaxValue);
+ }
+}
+
+Actual Results:
+max is -9223372036854775808
+d is -9.22337e+18
+Int64.MinValue: -9223372036854775808
+Int64.MaxValue: 9223372036854775807
+
+Expected Results:
+max is -9223372036854775808
+d is -9.22337203685478E+18
+Int64.MinValue: -9223372036854775808
+Int64.MaxValue: 9223372036854775807