mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-01 13:13:53 +00:00
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>
This commit is contained in:
parent
c2ea58c7f9
commit
b16c8c8ce4
@ -7,6 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
// [CLI11:public_includes:set]
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <exception>
|
||||
#include <limits>
|
||||
@ -1545,8 +1546,7 @@ inline std::string sum_string_vector(const std::vector<std::string> &values) {
|
||||
} else {
|
||||
if(val <= static_cast<double>((std::numeric_limits<std::int64_t>::min)()) ||
|
||||
val >= static_cast<double>((std::numeric_limits<std::int64_t>::max)()) ||
|
||||
// NOLINTNEXTLINE(clang-diagnostic-float-equal,bugprone-narrowing-conversions)
|
||||
val == static_cast<std::int64_t>(val)) {
|
||||
std::ceil(val) == std::floor(val)) {
|
||||
output = detail::value_string(static_cast<int64_t>(val));
|
||||
} else {
|
||||
output = detail::value_string(val);
|
||||
|
Loading…
x
Reference in New Issue
Block a user