473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

double.Parse produces overflow exception on double.MinValue

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
------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
Mar 6 '07 #1
2 3472

"Samuel R. Neff" <sa********@nomail.comwrote in message
news:1h********************************@4ax.com...
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())
http://www.google.com/search?hl=en&q...ouble.minvalue , first link
Mar 6 '07 #2

Thanks!

On Tue, 6 Mar 2007 19:07:35 +0100, "Artur Borecki"
<ab******************@tenbit.plwrote:
>
"Samuel R. Neff" <sa********@nomail.comwrote in message
news:1h********************************@4ax.com.. .
>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())

http://www.google.com/search?hl=en&q...ouble.minvalue , first link
------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
Mar 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Miguel Morales | last post by:
Hello: Currently, I am trying to solve a problem that requires the calculation of Airy functions for big arguments. Because Airy functions diverge rapidly for positive values, the results of the...
4
by: Chua Wen Ching | last post by:
Thanks Derek... Okay i had another question.. my program runs smoothly for the first minute, after 1 minute... suddenly it breaks and display this error: do you know what is the cause of...
2
by: Pascal | last post by:
Why does this not work, and how should i do this convert in stead: string x = double.MinValue.ToString(); double y = Convert.ToDouble(x); i get this exception: An unhandled exception of type...
5
by: Markus Kling | last post by:
"double.Parse(double.MaxValue.ToString())" yields the following Exception: Value was either too large or too small for a Double. at System.Number.ParseDouble(String value, NumberStyles options,...
1
by: Boni | last post by:
Dear all, is it possible to switch somehow to the mode where integer.maxvalue+1 will return integer.minvalue instead of throwing the exception? Thanks, Boni
14
by: kanepart2 | last post by:
Hi guys, I am having a problem with the following code snippet:- double x = (myReader); double y = (myReader); Resulting in the follwing compilation error: Cannot implicitly convert type...
23
by: dkirkdrei | last post by:
I am having a bit of trouble trying to double up on slashes in a file path. What I am trying to do is very similar to the code below: <? $var =...
206
by: md | last post by:
Hi Does any body know, how to round a double value with a specific number of digits after the decimal points? A function like this: RoundMyDouble (double &value, short numberOfPrecisions) ...
9
by: AGP | last post by:
I've been scratching my head for weeks to understand why some code doesnt work for me. here is what i have: dim sVal as string = "13.2401516" dim x as double x = sVal debug.writeline ( x)
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.