[Mono-list] Argh... ECMA & MS (was: Number style / format stuff)

Miguel de Icaza miguel@ximian.com
20 Sep 2001 13:53:13 -0400


Hello Derek,

> For instance, take the easiest case:
> 
> int f = 5;
> string s = f.ToString ();
> 
> MS yeilds "5" as one would expect.
> 
> ECMA docs will give you "5.00" or "5.0000000000" depending on how you feel

Oh, there is an explanation for that ;-)

The ToString() method is supposed to render data in a format suitable
for debugging purposes.  There are no guarantees on the formatting of
the data, as far as it provides information that can be used during
the debugging process (ie, so you can write: WriteLine (Something)).

For acurrate rendering you must use other mechanisms (and then you
point out other issues, but that is a separate topic that I feel very
ignorant about ;-)