I have a database table that needs to be converted to the current form. This table has three columns of type Double (it Pervasive.SQL , if anyone is interested).
My problem is that this table has been around for a long time, and it has been affected by code returning about 15 years or better.
Historically, we always used Double.MinValue (or any other language equivalent at the time) to represent the "blank" values provided by the user. The absence of meaning, in other words, is actually preserved as a value that we can recognize later and respond reasonably.
So, today my problem is that I need to iterate over these records and insert them into the newly created table (this is the "conversion" that I talked about). However, I do not see the consistent values in the tables that I convert. Here are the ones that I know for sure:
2.2250738585072014E-308 3.99285938963E-313 3.99099435427E-313 1.1125369292536007E-308 -5.389000690742776E279 2.104687961E-314
Now I understand that there are other ways that Double.MinValue can exist, or at least be represented. After doing some Google searches, I found that the former is a different Double.MinValue (actually DBL_MIN , which is referenced here: http://msdn.microsoft.com/en-us/library/6bs3y5ya(v=vs.100 ) .aspx ).
I do not want to be too long, so I will ask questions if this is not enough to help me. Suffice it to say, I need a reliable way to determine all the previous “minimum” values and replace them with the C # Double.MinValue constant when I Double.MinValue over these data rows.
If this turns out to be dataRow["Value"] < someConstant , then so be it. But I will allow mathematical theorists to help me in this decision.
Thanks for this time.
EDIT:
This is what I do with these values when I find them. This is part of a general method that collects the values that should be written to the database:
else if (c.DataType == typeof(System.Double)) { if (inRow[c] == DBNull.Value) retString += @"NULL"; else { Double d; if (Double.TryParse(inRow[c].ToString(), out d)) retString += d.ToStringFull(); } }
Until now, he just accepted them. And this is bad, because when the application finds them, they look like acceptable data, and not like Double.MinValue. Therefore, they are not considered spaces. But that is what they are.