[Mono-bugs] [Bug 55008][Wis] New - Double.Parse cannot parse Double.MaxValue

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 29 Feb 2004 16:47:11 -0500 (EST)


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 jaak@zd.com.pl.

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

--- shadow/55008	2004-02-29 16:47:11.000000000 -0500
+++ shadow/55008.tmp.3943	2004-02-29 16:47:11.000000000 -0500
@@ -0,0 +1,56 @@
+Bug#: 55008
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jaak@zd.com.pl               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Double.Parse cannot parse Double.MaxValue
+
+Double.Parse cannot correctly parse the value:
+
+1.79769313486232E+308
+
+which is a string representation of Double.MaxValue.
+
+--------------------
+using System;
+using System.Globalization;
+
+class C1 {
+    public static void Main() {
+        Double d = Double.MaxValue;
+        string s = d.ToString("R", CultureInfo.InvariantCulture);
+        Console.WriteLine("s: {0}", s);
+        Double d2 = Double.Parse(s, CultureInfo.InvariantCulture);
+        string s2 = d2.ToString("R", CultureInfo.InvariantCulture);
+        Console.WriteLine("s2: {0}", s2);
+    }
+}
+---------------------
+
+Actual Results:
+
+Unhandled Exception: System.OverflowException: Number overflow
+in <0x00b70> System.Double:Parse
+(string,System.Globalization.NumberStyles,System.IFormatProvider)
+in <0x00015> System.Double:Parse (string,System.IFormatProvider)
+in <0x0005f> C1:Main ()
+
+Expected Results:
+
+s: 1.79769313486232E+308
+s2: 1.79769313486232E+308
+
+How often does this happen? 
+
+All the time.