I am having some weird issue here. I have a database table which has huge value stored on a column. My application (C#) is reading this value and keeping in a double type. This application will insert the same value to another table. Note : I am not doing any calculations/processing on the value read from the first table. It is just kept for updating the second table.
Issue here is, the second table is getting slightly different value than in the first table. Looks like the number is rounding off when I keep in the double type.
Here is an example of values.
Original Value : 18014398509481984
Value copied to new table : 18014398509482000
The values looks different, but both are same in reality. I did a google search with 18014398509481984 - 18014398509482000 as a search term and it returned result 0, which means both are same.
Questions:
1 - If both are same, why the second value looks different? I can see 1984 turned into 2000.
2 - Why the conversion happens?
3 - How can I avoid this type of conversions?
Any help would be great!