Loss of precision when using ResultColumn.toLong()
migueljbento opened this issue · 1 comments
migueljbento commented
The implementation of ResultColumn#toLong converts the string value read from the database to a Double which then is cast to a Long.
First of all I would imagine that the Double conversion is to allow you to call toLong in double columns and get their values. This should be confirmed otherwise this is just an inefficient way of getting the value.
The main issue stems from the fact that a Double does not have precision to store all the values that can be represented by a Long. Both data types use 64 bits. In fact if you try to call this function with "-9223372036854775805" it will be converted to -9223372036854775808.