diff options
Diffstat (limited to 'absl/random/internal')
-rw-r--r-- | absl/random/internal/iostream_state_saver_test.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/absl/random/internal/iostream_state_saver_test.cc b/absl/random/internal/iostream_state_saver_test.cc index 722766d0ff6b..7bb8ad959cf6 100644 --- a/absl/random/internal/iostream_state_saver_test.cc +++ b/absl/random/internal/iostream_state_saver_test.cc @@ -196,8 +196,8 @@ TEST(IOStreamStateSaver, RoundTripFloats) { EXPECT_EQ(-d, StreamRoundTrip<double>(-d)); // Avoid undefined behavior (overflow/underflow). - if (d <= std::numeric_limits<int64_t>::max() && - d >= std::numeric_limits<int64_t>::lowest()) { + if (f <= static_cast<float>(std::numeric_limits<int64_t>::max()) && + f >= static_cast<float>(std::numeric_limits<int64_t>::lowest())) { int64_t x = static_cast<int64_t>(f); EXPECT_EQ(x, StreamRoundTrip<int64_t>(x)); } @@ -264,8 +264,8 @@ TEST(IOStreamStateSaver, RoundTripDoubles) { } // Avoid undefined behavior (overflow/underflow). - if (d <= std::numeric_limits<int64_t>::max() && - d >= std::numeric_limits<int64_t>::lowest()) { + if (d <= static_cast<double>(std::numeric_limits<int64_t>::max()) && + d >= static_cast<double>(std::numeric_limits<int64_t>::lowest())) { int64_t x = static_cast<int64_t>(d); EXPECT_EQ(x, StreamRoundTrip<int64_t>(x)); } |