internal static Exception TryToDouble(string s, out double result)
{
s = TrimString(s);
if (s == "-INF")
{
result = Double.NegativeInfinity;
return null;
}
else if (s == "INF")
{
result = Double.PositiveInfinity;
return null;
}
else if (!Double.TryParse(s, NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent, NumberFormatInfo.InvariantInfo, out result))
{
return new FormatException(SR.Format(SR.XmlConvert_BadFormat, s, "Double"));
}
if (result == 0 && s[0] == '-')
{
result = -0d;
}
return null;
}