This is generated C code from dbcppp dbc2 cli command

If you call both functions sequentially, you will find that the double conversion of the uint64_t will produce a very large value rather than negative value you are looking for.
Doing a reinterpret_cast of the binary data as an int, followed by a conversion back to a double will fix this behavior.

Surprised no one had encountered this earlier.
PS. the generated two successive return statements also seems to be an oversight