diff options
author | David Skoland <david.skoland@qt.io> | 2020-11-16 12:38:42 +0100 |
---|---|---|
committer | David Skoland <david.skoland@qt.io> | 2020-12-02 21:24:19 +0100 |
commit | 3ca921293a99e2eb3e9b43b5ce1f3e472fc3e0fb (patch) | |
tree | aae968ee94a40a6eda5195983afd6bccb1a124d6 /src/corelib/global/qglobal.cpp | |
parent | c3ffa6036b93c4e3f50b70809952464f751dc738 (diff) |
Add test for qRound
Add test for qRound that covers some edge cases for rounding. Note that
as of right now, this test fails and the docs have been updated to warn
that it should not be depended on for strict correctness.
Change-Id: I1a61bca47abd77855fe7c13ded44e913cc7e8722
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index bcfc6ada2e..ee857d61ac 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -968,6 +968,8 @@ static_assert((std::is_same<qsizetype, qptrdiff>::value)); Rounds half away from zero (e.g. 0.5 -> 1, -0.5 -> -1). + \note This function does not guarantee correctness for high precisions. + Example: \snippet code/src_corelib_global_qglobal.cpp 11A @@ -980,6 +982,8 @@ static_assert((std::is_same<qsizetype, qptrdiff>::value)); Rounds half away from zero (e.g. 0.5f -> 1, -0.5f -> -1). + \note This function does not guarantee correctness for high precisions. + Example: \snippet code/src_corelib_global_qglobal.cpp 11B @@ -992,6 +996,8 @@ static_assert((std::is_same<qsizetype, qptrdiff>::value)); Rounds half away from zero (e.g. 0.5 -> 1, -0.5 -> -1). + \note This function does not guarantee correctness for high precisions. + Example: \snippet code/src_corelib_global_qglobal.cpp 12A @@ -1004,6 +1010,8 @@ static_assert((std::is_same<qsizetype, qptrdiff>::value)); Rounds half away from zero (e.g. 0.5f -> 1, -0.5f -> -1). + \note This function does not guarantee correctness for high precisions. + Example: \snippet code/src_corelib_global_qglobal.cpp 12B |