S
Samuel R. Neff
I'm using a quasi open-source project and am running into an exception
in double.Parse which is effectively this:
double.Parse(double.MinValue.ToString())
System.OverflowException: Value was either too large or too small for
a Double.
at System.Number.ParseDouble(String s, NumberStyles style,
NumberFormatInfo info)
at System.Double.Parse(String s, NumberStyles style,
IFormatProvider provider)
at System.Double.Parse(String s)
double.MinValue is obviously a valid double so double.Parse should be
able to parse it's string represntation. So is this a bug? Is there
a work-around?
the actual code is this:
if(data is long || data is ulong || data is float || data is double ||
data is decimal)
{
WriteDouble(double.Parse(data.ToString()));
return;
}
Which could be improved, but double.Parse should still work in this
scenario.
Thanks,
Sam
in double.Parse which is effectively this:
double.Parse(double.MinValue.ToString())
System.OverflowException: Value was either too large or too small for
a Double.
at System.Number.ParseDouble(String s, NumberStyles style,
NumberFormatInfo info)
at System.Double.Parse(String s, NumberStyles style,
IFormatProvider provider)
at System.Double.Parse(String s)
double.MinValue is obviously a valid double so double.Parse should be
able to parse it's string represntation. So is this a bug? Is there
a work-around?
the actual code is this:
if(data is long || data is ulong || data is float || data is double ||
data is decimal)
{
WriteDouble(double.Parse(data.ToString()));
return;
}
Which could be improved, but double.Parse should still work in this
scenario.
Thanks,
Sam