[Mono-bugs] [Bug 66528][Wis] New - ToString(formatString) fails with double value of zero

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 22 Sep 2004 02:41:34 -0400 (EDT)


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 david@quintana.org.

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

--- shadow/66528	2004-09-22 02:41:34.000000000 -0400
+++ shadow/66528.tmp.5148	2004-09-22 02:41:34.000000000 -0400
@@ -0,0 +1,58 @@
+Bug#: 66528
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details: FC2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: david@quintana.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ToString(formatString) fails with double value of zero
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+When attempting to retrieve the string value of a Double that is equal to
+zero with a formatString, Mono crashes with an IndexOutOfRangeException.
+
+This occurs with Mono 1.0 on Windows and Linux (XP SP2 and FC2)
+
+Use the following code:
+
+// Following works
+double x = 1.0;
+Console.WriteLine(x.ToString("00.00E00");
+
+// Following doesn't work
+double  y = 0.0;
+Console.WriteLine(x.ToString("00.00E00");
+
+Steps to reproduce the problem:
+1. use the above code snippet
+2. compile with mcs
+3. run with mono
+
+Actual Results:
+Unhandled Exception: System.IndexOutOfRangeException: Array index is out of
+range.
+in <0x00032> System.Text.StringBuilder:get_Chars (int)
+in <0x00446> System.FloatingPointFormatter:FormatCustomParser
+(System.FloatingPointFormatter/Format,double,System.Globalization.NumberFormatInfo,string)
+in <0x0013e> System.FloatingPointFormatter:FormatCustom
+(System.FloatingPointFormatter/Format,double,System.Globalization.NumberFormatInfo,string)
+
+Expected Results:
+"00.00E00"
+
+How often does this happen? 
+Always
+
+Additional Information: