When converting a decimal to a double, sometimes there is some unexpected truncation. For example:
decimal dec = -96.31614743511301m;
double dbl = Convert.ToDouble(dec); // dbl = -96.316147435113, why?
For other values it works as expected:
decimal dec2 = -96.269592225955307m;
double dbl2 = Convert.ToDouble(dec2); // dbl2 = -96.269592225955307, expected
Note that the second example which works actually has more decimal places than the first which doesn't. Also, the first value can be converted successfully into a double using this convoluted code:
dbl = Convert.ToDouble(dec.ToString()); // dbl = -96.31614743511301, expected
So why is the double value truncated in the first example?