summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-05-30 12:23:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-05-30 16:12:03 +0000
commitccfb309b908339d45339f7db084bc6f653757de9 (patch)
tree15c956ceccfeef6567846002ef6b39a78f2a887e /src
parent04ebb981ab911fe527deb5b247fdc9392d9be535 (diff)
Document qRound's rounding semantics
This differs from both C rounding (away from zero), and IEEE-754 rounding (to even). Change-Id: I2cdd358824ca14c922b23029308e3ce3258c1d8f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 2ca627e851..2fbd31b3d7 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -939,6 +939,8 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
Rounds \a d to the nearest integer.
+ Rounds half up (e.g. 0.5 -> 1, -0.5 -> 0).
+
Example:
\snippet code/src_corelib_global_qglobal.cpp 11A
@@ -949,6 +951,8 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
Rounds \a d to the nearest integer.
+ Rounds half up (e.g. 0.5f -> 1, -0.5f -> 0).
+
Example:
\snippet code/src_corelib_global_qglobal.cpp 11B
@@ -959,6 +963,8 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
Rounds \a d to the nearest 64-bit integer.
+ Rounds half up (e.g. 0.5 -> 1, -0.5 -> 0).
+
Example:
\snippet code/src_corelib_global_qglobal.cpp 12A
@@ -969,6 +975,8 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
Rounds \a d to the nearest 64-bit integer.
+ Rounds half up (e.g. 0.5f -> 1, -0.5f -> 0).
+
Example:
\snippet code/src_corelib_global_qglobal.cpp 12B