Skip to content

Commit 3e210da

Browse files
committed
Fix MSVC warning
1 parent 88b45d6 commit 3e210da

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

examples/integral_conversions.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,24 @@ int main()
5555
// Constructing a decimal value from an integer is lossless until
5656
// the number of digits in the integer exceeds the precision of the decimal type
5757

58-
if (std::numeric_limits<decimal64_t>::digits10 >= std::numeric_limits<std::uint32_t>::digits10)
59-
{
60-
std::cout << "Conversions will be lossless\n";
58+
std::cout << "Conversions will be lossless\n"
59+
<< " decimal64_t digits10: " << std::numeric_limits<decimal64_t>::digits10 << "\n"
60+
<< "std::uint32_t digits10: " << std::numeric_limits<std::uint32_t>::digits10 << "\n";
6161

62-
constexpr decimal64_t decimal_from_max {std::numeric_limits<std::uint32_t>::max()};
63-
std::cout << " std::uint32_t max: " << std::numeric_limits<std::uint32_t>::max() << "\n"
64-
<< "decimal64_t from max: " << decimal_from_max << "\n\n";
65-
}
62+
constexpr decimal64_t decimal_from_u32_max {std::numeric_limits<std::uint32_t>::max()};
63+
std::cout << " std::uint32_t max: " << std::numeric_limits<std::uint32_t>::max() << "\n"
64+
<< "decimal64_t from max: " << decimal_from_u32_max << "\n\n";
6665

67-
if (std::numeric_limits<decimal32_t>::digits10 < std::numeric_limits<std::uint64_t>::digits10)
68-
{
69-
// In the construction of lossy values the rounding will be handled according to
70-
// the current global rounding mode.
66+
// In the construction of lossy values the rounding will be handled according to
67+
// the current global rounding mode.
7168

72-
std::cout << "Conversions will be lossy\n";
73-
constexpr decimal32_t decimal_from_max {std::numeric_limits<std::uint64_t>::max()};
74-
std::cout << " std::uint64_t max: " << std::numeric_limits<std::uint64_t>::max() << "\n"
75-
<< "decimal32_t from max: " << decimal_from_max << '\n';
76-
}
69+
std::cout << "Conversions will be lossy\n"
70+
<< " decimal32_t digits10: " << std::numeric_limits<decimal32_t>::digits10 << "\n"
71+
<< "std::uint64_t digits10: " << std::numeric_limits<std::uint64_t>::digits10 << "\n";
72+
73+
constexpr decimal32_t decimal_from_u64_max {std::numeric_limits<std::uint64_t>::max()};
74+
std::cout << " std::uint64_t max: " << std::numeric_limits<std::uint64_t>::max() << "\n"
75+
<< "decimal32_t from max: " << decimal_from_u64_max << '\n';
7776

7877
return 0;
7978
}

0 commit comments

Comments
 (0)