Fix compiler warning introduced in PR575 (#593)

pull/578/head
Anup Gangwar 2022-02-14 14:45:19 -06:00 committed by GitHub
parent 78c7844c6c
commit dfc07d11d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -115,8 +115,9 @@ template <typename T>
static bool isInValidRange(bool isFloat, const double &doubleValue, bool isInt,
const int64_t &intValue) {
if (isFloat) {
return (doubleValue >= std::numeric_limits<T>::min()) &&
(doubleValue <= std::numeric_limits<T>::max());
// Do a round-trip check here instead of numeric limits due to
// compiler warnings around double <-> int conversion.
return (doubleValue == static_cast<double>(static_cast<T>(doubleValue)));
} else {
assert(isInt);
return (intValue >= std::numeric_limits<T>::min()) &&