I'm having some problems with the conversion of value from an OracleDecimal. Here is the code
public static T GetReaderValue(this OracleDataReader dr, string col) where T : struct
{
int colNo = dr.GetOrdinal(col);
var value = (double)OracleDecimal.SetPrecision(dr.GetOracleDecimal(colNo), 28);
return (T) Convert.ChangeType(value, typeof(T), CultureInfo.InvariantCulture);
}
This works fine for most values but for some, like 0.12345, it returns numbers like 0.123499999999.
Can anyone offer some advise on how to convert OracleDecimal without these rounding errors?
Thanks!