Add an util function to cast double to int64_t