Current approach is:
Inaccuracy is due to fact that only integers from −2^53 to 2^53 can be represented accurately by double precision without any loss. Hence, above approach would not work for numbers like -0.43149576573887316. For DecimalValue representing -0.43149576573887316, value_ would be -43149576573887316 and scale would be 17. As value_ < -2^53, result would not be accurate.
Hence through discussion in IMPALA-10350, we propose to use thirdparty library https://github.com/lemire/fast_double_parser, which handles above scenario in a performant manner. Library's internal representation of Decimal is similar to the Impala's DecimalValue and function compute_float_64 can be used for the conversion.