Skip to content

Commit b16c8c8

Browse files
Update TypeTools.hpp (#803)
* Update TypeTools.hpp fix #802 by using checking `std::ceil(val) == std::floor(val)` instead of `val == static_cast<std::int64_t>(val)` to avoid warnings- * style: pre-commit.ci fixes Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent c2ea58c commit b16c8c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/CLI/TypeTools.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#pragma once
88

99
// [CLI11:public_includes:set]
10+
#include <cmath>
1011
#include <cstdint>
1112
#include <exception>
1213
#include <limits>
@@ -1545,8 +1546,7 @@ inline std::string sum_string_vector(const std::vector<std::string> &values) {
15451546
} else {
15461547
if(val <= static_cast<double>((std::numeric_limits<std::int64_t>::min)()) ||
15471548
val >= static_cast<double>((std::numeric_limits<std::int64_t>::max)()) ||
1548-
// NOLINTNEXTLINE(clang-diagnostic-float-equal,bugprone-narrowing-conversions)
1549-
val == static_cast<std::int64_t>(val)) {
1549+
std::ceil(val) == std::floor(val)) {
15501550
output = detail::value_string(static_cast<int64_t>(val));
15511551
} else {
15521552
output = detail::value_string(val);

0 commit comments

Comments
 (0)