FTDC converts doubles to int64. This leads to undefined behavior if the double is -inf, +inf or does not fit in [INT64_MIN, INT64_MAX].
This was detected by clang's ubsan sanitizer
-fsanitize=float-cast-overflow: Conversion to, from, or between floating-point types which would overflow the destination. Because the range of representable values for all floating-point types supported by Clang is [-inf, +inf], the only cases detected are conversions from floating point to integer types.
References:
https://github.com/llvm/llvm-project/blob/42170b3b4e1f7d30b377a3da07c354feae9b852e/compiler-rt/lib/ubsan/ubsan_handlers.cpp#L481-L520
https://github.com/llvm/llvm-project/blob/646f19bb9dc86ea5baf38969697a15d0f162ddb0/clang/lib/CodeGen/CGExprScalar.cpp#L897-L963