[Mono-bugs] [Bug 320424] XmlConvert.ToString(double) should use roundtrip format

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu May 15 13:43:42 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=320424

User brannon.king at autonomoussolutions.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=320424#c1


Brannon King <brannon.king at autonomoussolutions.com> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |brannon.king at autonomoussolutions.com




--- Comment #1 from Brannon King <brannon.king at autonomoussolutions.com>  2008-05-15 11:43:41 MST ---
This bug is way easy to fix. Please, somebody with authority to check this into
the trunk, do so immediately.

Change XmlConvert.cs lines 

public static string ToString(double value)
{
        if (Double.IsNegativeInfinity(value)) return "-INF";
        if (Double.IsPositiveInfinity(value)) return "INF";
        if (Double.IsNaN(value)) return "NaN";
        return value.ToString(CultureInfo.InvariantCulture);
}

public static string ToString(float value)
{
        if (Single.IsNegativeInfinity(value)) return "-INF";
        if (Single.IsPositiveInfinity(value)) return "INF";
        if (Single.IsNaN(value)) return "NaN";
        return value.ToString(CultureInfo.InvariantCulture);
}

to read (note the "R"):

public static string ToString(double value)
{
        if (Double.IsNegativeInfinity(value)) return "-INF";
        if (Double.IsPositiveInfinity(value)) return "INF";
        if (Double.IsNaN(value)) return "NaN";
        return value.ToString("R", CultureInfo.InvariantCulture);
}

public static string ToString(float value)
{
        if (Single.IsNegativeInfinity(value)) return "-INF";
        if (Single.IsPositiveInfinity(value)) return "INF";
        if (Single.IsNaN(value)) return "NaN";
        return value.ToString("R", CultureInfo.InvariantCulture);
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list