diff options
author | Copybara-Service <copybara-worker@google.com> | 2023-07-11 18:37:29 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-07-11 18:37:29 (GMT) |
commit | cc366710bbf40a9816d47c35802d06dbaccb8792 (patch) | |
tree | 517475822a761a2856cd4773d503d5ff365e3283 /googletest | |
parent | 4a1a299b206ba250a4318f74938ea67c75c3c0c9 (diff) | |
parent | 3044657e7afa759ce875a8161cd4bff0fd2e22bc (diff) | |
download | googletest-cc366710bbf40a9816d47c35802d06dbaccb8792.zip googletest-cc366710bbf40a9816d47c35802d06dbaccb8792.tar.gz googletest-cc366710bbf40a9816d47c35802d06dbaccb8792.tar.bz2 |
Merge pull request #4308 from smr99:fix-float-cast
PiperOrigin-RevId: 547250378
Change-Id: I084c30e45f331cb296535822923da1cb7e848e11
Diffstat (limited to 'googletest')
-rw-r--r-- | googletest/include/gtest/gtest-printers.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index bcdecd1..1ba5178 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -531,7 +531,7 @@ int AppropriateResolution(FloatType val) { } else if (val >= 0.0001) { mulfor6 = 1e9; } - if (static_cast<float>(static_cast<int32_t>(val * mulfor6 + 0.5)) / + if (static_cast<FloatType>(static_cast<int32_t>(val * mulfor6 + 0.5)) / mulfor6 == val) return 6; @@ -546,7 +546,7 @@ int AppropriateResolution(FloatType val) { } else if (val >= 1e6) { // 1,000,000 to 9,999,999 divfor6 = 10; } - if (static_cast<float>(static_cast<int32_t>(val / divfor6 + 0.5)) * + if (static_cast<FloatType>(static_cast<int32_t>(val / divfor6 + 0.5)) * divfor6 == val) return 6; |